
obj/user/hello:     file format elf32-i386


Disassembly of section .text:

00800020 <_start>:
// starts us running when we are initially loaded into a new environment.
.text
.globl _start
_start:
	// See if we were started with arguments on the stack
	cmpl $USTACKTOP, %esp
  800020:	81 fc 00 e0 bf ee    	cmp    $0xeebfe000,%esp
	jne args_exist
  800026:	75 04                	jne    80002c <args_exist>

	// If not, push dummy argc/argv arguments.
	// This happens when we are loaded by the kernel,
	// because the kernel does not know about passing arguments.
	pushl $0
  800028:	6a 00                	push   $0x0
	pushl $0
  80002a:	6a 00                	push   $0x0

0080002c <args_exist>:

args_exist:
	call libmain
  80002c:	e8 2f 00 00 00       	call   800060 <libmain>
1:	jmp 1b
  800031:	eb fe                	jmp    800031 <args_exist+0x5>
	...

00800034 <umain>:
// hello, world
#include <inc/lib.h>

void
umain(void)
{
  800034:	55                   	push   %ebp
  800035:	89 e5                	mov    %esp,%ebp
  800037:	83 ec 18             	sub    $0x18,%esp
	cprintf("hello, world\n");
  80003a:	c7 04 24 00 28 80 00 	movl   $0x802800,(%esp)
  800041:	e8 e7 00 00 00       	call   80012d <cprintf>
	cprintf("i am environment %08x\n", env->env_id);
  800046:	a1 74 60 80 00       	mov    0x806074,%eax
  80004b:	8b 40 4c             	mov    0x4c(%eax),%eax
  80004e:	89 44 24 04          	mov    %eax,0x4(%esp)
  800052:	c7 04 24 0e 28 80 00 	movl   $0x80280e,(%esp)
  800059:	e8 cf 00 00 00       	call   80012d <cprintf>
}
  80005e:	c9                   	leave  
  80005f:	c3                   	ret    

00800060 <libmain>:
volatile struct Env *env;
char *binaryname = "(PROGRAM NAME UNKNOWN)";

void
libmain(int argc, char **argv)
{
  800060:	55                   	push   %ebp
  800061:	89 e5                	mov    %esp,%ebp
  800063:	83 ec 18             	sub    $0x18,%esp
  800066:	89 5d f8             	mov    %ebx,-0x8(%ebp)
  800069:	89 75 fc             	mov    %esi,-0x4(%ebp)
  80006c:	8b 75 08             	mov    0x8(%ebp),%esi
  80006f:	8b 5d 0c             	mov    0xc(%ebp),%ebx
	// set env to point at our env structure in envs[].
	// LAB 3: Your code here.
  envid_t envid   = sys_getenvid();
  800072:	e8 72 0f 00 00       	call   800fe9 <sys_getenvid>
	env = &envs [ENVX(envid)];
  800077:	25 ff 03 00 00       	and    $0x3ff,%eax
  80007c:	6b c0 7c             	imul   $0x7c,%eax,%eax
  80007f:	05 00 00 c0 ee       	add    $0xeec00000,%eax
  800084:	a3 74 60 80 00       	mov    %eax,0x806074

	// save the name of the program so that panic() can use it
	if (argc > 0)
  800089:	85 f6                	test   %esi,%esi
  80008b:	7e 07                	jle    800094 <libmain+0x34>
		binaryname = argv[0];
  80008d:	8b 03                	mov    (%ebx),%eax
  80008f:	a3 00 60 80 00       	mov    %eax,0x806000

	// call user main routine
	umain(argc, argv);
  800094:	89 5c 24 04          	mov    %ebx,0x4(%esp)
  800098:	89 34 24             	mov    %esi,(%esp)
  80009b:	e8 94 ff ff ff       	call   800034 <umain>

	// exit gracefully
	exit();
  8000a0:	e8 0b 00 00 00       	call   8000b0 <exit>
}
  8000a5:	8b 5d f8             	mov    -0x8(%ebp),%ebx
  8000a8:	8b 75 fc             	mov    -0x4(%ebp),%esi
  8000ab:	89 ec                	mov    %ebp,%esp
  8000ad:	5d                   	pop    %ebp
  8000ae:	c3                   	ret    
	...

008000b0 <exit>:

#include <inc/lib.h>

void
exit(void)
{
  8000b0:	55                   	push   %ebp
  8000b1:	89 e5                	mov    %esp,%ebp
  8000b3:	83 ec 18             	sub    $0x18,%esp
	close_all();
  8000b6:	e8 fe 14 00 00       	call   8015b9 <close_all>
	sys_env_destroy(0);
  8000bb:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
  8000c2:	e8 56 0f 00 00       	call   80101d <sys_env_destroy>
}
  8000c7:	c9                   	leave  
  8000c8:	c3                   	ret    
  8000c9:	00 00                	add    %al,(%eax)
	...

008000cc <vcprintf>:
	b->cnt++;
}

int
vcprintf(const char *fmt, va_list ap)
{
  8000cc:	55                   	push   %ebp
  8000cd:	89 e5                	mov    %esp,%ebp
  8000cf:	81 ec 28 01 00 00    	sub    $0x128,%esp
	struct printbuf b;

	b.idx = 0;
  8000d5:	c7 85 f0 fe ff ff 00 	movl   $0x0,-0x110(%ebp)
  8000dc:	00 00 00 
	b.cnt = 0;
  8000df:	c7 85 f4 fe ff ff 00 	movl   $0x0,-0x10c(%ebp)
  8000e6:	00 00 00 
	vprintfmt((void*)putch, &b, fmt, ap);
  8000e9:	8b 45 0c             	mov    0xc(%ebp),%eax
  8000ec:	89 44 24 0c          	mov    %eax,0xc(%esp)
  8000f0:	8b 45 08             	mov    0x8(%ebp),%eax
  8000f3:	89 44 24 08          	mov    %eax,0x8(%esp)
  8000f7:	8d 85 f0 fe ff ff    	lea    -0x110(%ebp),%eax
  8000fd:	89 44 24 04          	mov    %eax,0x4(%esp)
  800101:	c7 04 24 47 01 80 00 	movl   $0x800147,(%esp)
  800108:	e8 d0 01 00 00       	call   8002dd <vprintfmt>
	sys_cputs(b.buf, b.idx);
  80010d:	8b 85 f0 fe ff ff    	mov    -0x110(%ebp),%eax
  800113:	89 44 24 04          	mov    %eax,0x4(%esp)
  800117:	8d 85 f8 fe ff ff    	lea    -0x108(%ebp),%eax
  80011d:	89 04 24             	mov    %eax,(%esp)
  800120:	e8 cb 0a 00 00       	call   800bf0 <sys_cputs>

	return b.cnt;
}
  800125:	8b 85 f4 fe ff ff    	mov    -0x10c(%ebp),%eax
  80012b:	c9                   	leave  
  80012c:	c3                   	ret    

0080012d <cprintf>:

int
cprintf(const char *fmt, ...)
{
  80012d:	55                   	push   %ebp
  80012e:	89 e5                	mov    %esp,%ebp
  800130:	83 ec 18             	sub    $0x18,%esp

	return b.cnt;
}

int
cprintf(const char *fmt, ...)
  800133:	8d 45 0c             	lea    0xc(%ebp),%eax
{
	va_list ap;
	int cnt;

	va_start(ap, fmt);
	cnt = vcprintf(fmt, ap);
  800136:	89 44 24 04          	mov    %eax,0x4(%esp)
  80013a:	8b 45 08             	mov    0x8(%ebp),%eax
  80013d:	89 04 24             	mov    %eax,(%esp)
  800140:	e8 87 ff ff ff       	call   8000cc <vcprintf>
	va_end(ap);

	return cnt;
}
  800145:	c9                   	leave  
  800146:	c3                   	ret    

00800147 <putch>:
};


static void
putch(int ch, struct printbuf *b)
{
  800147:	55                   	push   %ebp
  800148:	89 e5                	mov    %esp,%ebp
  80014a:	53                   	push   %ebx
  80014b:	83 ec 14             	sub    $0x14,%esp
  80014e:	8b 5d 0c             	mov    0xc(%ebp),%ebx
	b->buf[b->idx++] = ch;
  800151:	8b 03                	mov    (%ebx),%eax
  800153:	8b 55 08             	mov    0x8(%ebp),%edx
  800156:	88 54 03 08          	mov    %dl,0x8(%ebx,%eax,1)
  80015a:	83 c0 01             	add    $0x1,%eax
  80015d:	89 03                	mov    %eax,(%ebx)
	if (b->idx == 256-1) {
  80015f:	3d ff 00 00 00       	cmp    $0xff,%eax
  800164:	75 19                	jne    80017f <putch+0x38>
		sys_cputs(b->buf, b->idx);
  800166:	c7 44 24 04 ff 00 00 	movl   $0xff,0x4(%esp)
  80016d:	00 
  80016e:	8d 43 08             	lea    0x8(%ebx),%eax
  800171:	89 04 24             	mov    %eax,(%esp)
  800174:	e8 77 0a 00 00       	call   800bf0 <sys_cputs>
		b->idx = 0;
  800179:	c7 03 00 00 00 00    	movl   $0x0,(%ebx)
	}
	b->cnt++;
  80017f:	83 43 04 01          	addl   $0x1,0x4(%ebx)
}
  800183:	83 c4 14             	add    $0x14,%esp
  800186:	5b                   	pop    %ebx
  800187:	5d                   	pop    %ebp
  800188:	c3                   	ret    
  800189:	00 00                	add    %al,(%eax)
  80018b:	00 00                	add    %al,(%eax)
  80018d:	00 00                	add    %al,(%eax)
	...

00800190 <printnum>:
 * using specified putch function and associated pointer putdat.
 */
static void
printnum(void (*putch)(int, void*), void *putdat,
	 unsigned long long num, unsigned base, int width, int padc)
{
  800190:	55                   	push   %ebp
  800191:	89 e5                	mov    %esp,%ebp
  800193:	57                   	push   %edi
  800194:	56                   	push   %esi
  800195:	53                   	push   %ebx
  800196:	83 ec 4c             	sub    $0x4c,%esp
  800199:	89 45 e4             	mov    %eax,-0x1c(%ebp)
  80019c:	89 d6                	mov    %edx,%esi
  80019e:	8b 45 08             	mov    0x8(%ebp),%eax
  8001a1:	89 45 d8             	mov    %eax,-0x28(%ebp)
  8001a4:	8b 55 0c             	mov    0xc(%ebp),%edx
  8001a7:	89 55 e0             	mov    %edx,-0x20(%ebp)
  8001aa:	8b 45 10             	mov    0x10(%ebp),%eax
  8001ad:	8b 5d 14             	mov    0x14(%ebp),%ebx
  8001b0:	8b 7d 18             	mov    0x18(%ebp),%edi
	// first recursively print all preceding (more significant) digits
	if (num >= base) {
  8001b3:	89 45 dc             	mov    %eax,-0x24(%ebp)
  8001b6:	b9 00 00 00 00       	mov    $0x0,%ecx
  8001bb:	39 d1                	cmp    %edx,%ecx
  8001bd:	72 15                	jb     8001d4 <printnum+0x44>
  8001bf:	77 07                	ja     8001c8 <printnum+0x38>
  8001c1:	8b 55 d8             	mov    -0x28(%ebp),%edx
  8001c4:	39 d0                	cmp    %edx,%eax
  8001c6:	76 0c                	jbe    8001d4 <printnum+0x44>
		printnum(putch, putdat, num / base, base, width - 1, padc);
	} else {
		// print any needed pad characters before first digit
		while (--width > 0)
  8001c8:	83 eb 01             	sub    $0x1,%ebx
  8001cb:	85 db                	test   %ebx,%ebx
  8001cd:	8d 76 00             	lea    0x0(%esi),%esi
  8001d0:	7f 61                	jg     800233 <printnum+0xa3>
  8001d2:	eb 70                	jmp    800244 <printnum+0xb4>
printnum(void (*putch)(int, void*), void *putdat,
	 unsigned long long num, unsigned base, int width, int padc)
{
	// first recursively print all preceding (more significant) digits
	if (num >= base) {
		printnum(putch, putdat, num / base, base, width - 1, padc);
  8001d4:	89 7c 24 10          	mov    %edi,0x10(%esp)
  8001d8:	83 eb 01             	sub    $0x1,%ebx
  8001db:	89 5c 24 0c          	mov    %ebx,0xc(%esp)
  8001df:	89 44 24 08          	mov    %eax,0x8(%esp)
  8001e3:	8b 4c 24 08          	mov    0x8(%esp),%ecx
  8001e7:	8b 5c 24 0c          	mov    0xc(%esp),%ebx
  8001eb:	89 4d d0             	mov    %ecx,-0x30(%ebp)
  8001ee:	89 5d d4             	mov    %ebx,-0x2c(%ebp)
  8001f1:	8b 5d dc             	mov    -0x24(%ebp),%ebx
  8001f4:	89 5c 24 08          	mov    %ebx,0x8(%esp)
  8001f8:	c7 44 24 0c 00 00 00 	movl   $0x0,0xc(%esp)
  8001ff:	00 
  800200:	8b 45 d8             	mov    -0x28(%ebp),%eax
  800203:	89 04 24             	mov    %eax,(%esp)
  800206:	8b 55 e0             	mov    -0x20(%ebp),%edx
  800209:	89 54 24 04          	mov    %edx,0x4(%esp)
  80020d:	e8 7e 23 00 00       	call   802590 <__udivdi3>
  800212:	8b 4d d0             	mov    -0x30(%ebp),%ecx
  800215:	8b 5d d4             	mov    -0x2c(%ebp),%ebx
  800218:	89 4c 24 08          	mov    %ecx,0x8(%esp)
  80021c:	89 5c 24 0c          	mov    %ebx,0xc(%esp)
  800220:	89 04 24             	mov    %eax,(%esp)
  800223:	89 54 24 04          	mov    %edx,0x4(%esp)
  800227:	89 f2                	mov    %esi,%edx
  800229:	8b 45 e4             	mov    -0x1c(%ebp),%eax
  80022c:	e8 5f ff ff ff       	call   800190 <printnum>
  800231:	eb 11                	jmp    800244 <printnum+0xb4>
	} else {
		// print any needed pad characters before first digit
		while (--width > 0)
			putch(padc, putdat);
  800233:	89 74 24 04          	mov    %esi,0x4(%esp)
  800237:	89 3c 24             	mov    %edi,(%esp)
  80023a:	ff 55 e4             	call   *-0x1c(%ebp)
	// first recursively print all preceding (more significant) digits
	if (num >= base) {
		printnum(putch, putdat, num / base, base, width - 1, padc);
	} else {
		// print any needed pad characters before first digit
		while (--width > 0)
  80023d:	83 eb 01             	sub    $0x1,%ebx
  800240:	85 db                	test   %ebx,%ebx
  800242:	7f ef                	jg     800233 <printnum+0xa3>
			putch(padc, putdat);
	}

	// then print this (the least significant) digit
	putch("0123456789abcdef"[num % base], putdat);
  800244:	89 74 24 04          	mov    %esi,0x4(%esp)
  800248:	8b 74 24 04          	mov    0x4(%esp),%esi
  80024c:	8b 45 dc             	mov    -0x24(%ebp),%eax
  80024f:	89 44 24 08          	mov    %eax,0x8(%esp)
  800253:	c7 44 24 0c 00 00 00 	movl   $0x0,0xc(%esp)
  80025a:	00 
  80025b:	8b 55 d8             	mov    -0x28(%ebp),%edx
  80025e:	89 14 24             	mov    %edx,(%esp)
  800261:	8b 4d e0             	mov    -0x20(%ebp),%ecx
  800264:	89 4c 24 04          	mov    %ecx,0x4(%esp)
  800268:	e8 53 24 00 00       	call   8026c0 <__umoddi3>
  80026d:	89 74 24 04          	mov    %esi,0x4(%esp)
  800271:	0f be 80 3c 28 80 00 	movsbl 0x80283c(%eax),%eax
  800278:	89 04 24             	mov    %eax,(%esp)
  80027b:	ff 55 e4             	call   *-0x1c(%ebp)
}
  80027e:	83 c4 4c             	add    $0x4c,%esp
  800281:	5b                   	pop    %ebx
  800282:	5e                   	pop    %esi
  800283:	5f                   	pop    %edi
  800284:	5d                   	pop    %ebp
  800285:	c3                   	ret    

00800286 <getuint>:

// Get an unsigned int of various possible sizes from a varargs list,
// depending on the lflag parameter.
static unsigned long long
getuint(va_list *ap, int lflag)
{
  800286:	55                   	push   %ebp
  800287:	89 e5                	mov    %esp,%ebp
	if (lflag >= 2)
  800289:	83 fa 01             	cmp    $0x1,%edx
  80028c:	7e 0e                	jle    80029c <getuint+0x16>
		return va_arg(*ap, unsigned long long);
  80028e:	8b 10                	mov    (%eax),%edx
  800290:	8d 4a 08             	lea    0x8(%edx),%ecx
  800293:	89 08                	mov    %ecx,(%eax)
  800295:	8b 02                	mov    (%edx),%eax
  800297:	8b 52 04             	mov    0x4(%edx),%edx
  80029a:	eb 22                	jmp    8002be <getuint+0x38>
	else if (lflag)
  80029c:	85 d2                	test   %edx,%edx
  80029e:	74 10                	je     8002b0 <getuint+0x2a>
		return va_arg(*ap, unsigned long);
  8002a0:	8b 10                	mov    (%eax),%edx
  8002a2:	8d 4a 04             	lea    0x4(%edx),%ecx
  8002a5:	89 08                	mov    %ecx,(%eax)
  8002a7:	8b 02                	mov    (%edx),%eax
  8002a9:	ba 00 00 00 00       	mov    $0x0,%edx
  8002ae:	eb 0e                	jmp    8002be <getuint+0x38>
	else
		return va_arg(*ap, unsigned int);
  8002b0:	8b 10                	mov    (%eax),%edx
  8002b2:	8d 4a 04             	lea    0x4(%edx),%ecx
  8002b5:	89 08                	mov    %ecx,(%eax)
  8002b7:	8b 02                	mov    (%edx),%eax
  8002b9:	ba 00 00 00 00       	mov    $0x0,%edx
}
  8002be:	5d                   	pop    %ebp
  8002bf:	c3                   	ret    

008002c0 <sprintputch>:
	int cnt;
};

static void
sprintputch(int ch, struct sprintbuf *b)
{
  8002c0:	55                   	push   %ebp
  8002c1:	89 e5                	mov    %esp,%ebp
  8002c3:	8b 45 0c             	mov    0xc(%ebp),%eax
	b->cnt++;
  8002c6:	83 40 08 01          	addl   $0x1,0x8(%eax)
	if (b->buf < b->ebuf)
  8002ca:	8b 10                	mov    (%eax),%edx
  8002cc:	3b 50 04             	cmp    0x4(%eax),%edx
  8002cf:	73 0a                	jae    8002db <sprintputch+0x1b>
		*b->buf++ = ch;
  8002d1:	8b 4d 08             	mov    0x8(%ebp),%ecx
  8002d4:	88 0a                	mov    %cl,(%edx)
  8002d6:	83 c2 01             	add    $0x1,%edx
  8002d9:	89 10                	mov    %edx,(%eax)
}
  8002db:	5d                   	pop    %ebp
  8002dc:	c3                   	ret    

008002dd <vprintfmt>:
// Main function to format and print a string.
void printfmt(void (*putch)(int, void*), void *putdat, const char *fmt, ...);

void
vprintfmt(void (*putch)(int, void*), void *putdat, const char *fmt, va_list ap)
{
  8002dd:	55                   	push   %ebp
  8002de:	89 e5                	mov    %esp,%ebp
  8002e0:	57                   	push   %edi
  8002e1:	56                   	push   %esi
  8002e2:	53                   	push   %ebx
  8002e3:	83 ec 5c             	sub    $0x5c,%esp
  8002e6:	8b 7d 08             	mov    0x8(%ebp),%edi
  8002e9:	8b 75 0c             	mov    0xc(%ebp),%esi
  8002ec:	8b 5d 10             	mov    0x10(%ebp),%ebx
		case '#':
			altflag = 1;
			goto reswitch;

		process_precision:
			if (width < 0)
  8002ef:	c7 45 c8 ff ff ff ff 	movl   $0xffffffff,-0x38(%ebp)
  8002f6:	eb 11                	jmp    800309 <vprintfmt+0x2c>
	int base, lflag, width, precision, altflag;
	char padc;

	while (1) {
		while ((ch = *(unsigned char *) fmt++) != '%') {
			if (ch == '\0')
  8002f8:	85 c0                	test   %eax,%eax
  8002fa:	0f 84 f9 03 00 00    	je     8006f9 <vprintfmt+0x41c>
				return;
			putch(ch, putdat);
  800300:	89 74 24 04          	mov    %esi,0x4(%esp)
  800304:	89 04 24             	mov    %eax,(%esp)
  800307:	ff d7                	call   *%edi
	unsigned long long num;
	int base, lflag, width, precision, altflag;
	char padc;

	while (1) {
		while ((ch = *(unsigned char *) fmt++) != '%') {
  800309:	0f b6 03             	movzbl (%ebx),%eax
  80030c:	83 c3 01             	add    $0x1,%ebx
  80030f:	83 f8 25             	cmp    $0x25,%eax
  800312:	75 e4                	jne    8002f8 <vprintfmt+0x1b>
  800314:	c6 45 d4 20          	movb   $0x20,-0x2c(%ebp)
  800318:	c7 45 d8 00 00 00 00 	movl   $0x0,-0x28(%ebp)
  80031f:	c7 45 d0 ff ff ff ff 	movl   $0xffffffff,-0x30(%ebp)
  800326:	c7 45 e4 ff ff ff ff 	movl   $0xffffffff,-0x1c(%ebp)
  80032d:	b9 00 00 00 00       	mov    $0x0,%ecx
  800332:	eb 06                	jmp    80033a <vprintfmt+0x5d>
  800334:	c6 45 d4 2d          	movb   $0x2d,-0x2c(%ebp)
  800338:	89 c3                	mov    %eax,%ebx
		width = -1;
		precision = -1;
		lflag = 0;
		altflag = 0;
	reswitch:
		switch (ch = *(unsigned char *) fmt++) {
  80033a:	0f b6 13             	movzbl (%ebx),%edx
  80033d:	0f b6 c2             	movzbl %dl,%eax
  800340:	89 45 e0             	mov    %eax,-0x20(%ebp)
  800343:	8d 43 01             	lea    0x1(%ebx),%eax
  800346:	83 ea 23             	sub    $0x23,%edx
  800349:	80 fa 55             	cmp    $0x55,%dl
  80034c:	0f 87 8a 03 00 00    	ja     8006dc <vprintfmt+0x3ff>
  800352:	0f b6 d2             	movzbl %dl,%edx
  800355:	ff 24 95 80 29 80 00 	jmp    *0x802980(,%edx,4)
  80035c:	c6 45 d4 30          	movb   $0x30,-0x2c(%ebp)
  800360:	eb d6                	jmp    800338 <vprintfmt+0x5b>
		case '6':
		case '7':
		case '8':
		case '9':
			for (precision = 0; ; ++fmt) {
				precision = precision * 10 + ch - '0';
  800362:	8b 55 e0             	mov    -0x20(%ebp),%edx
  800365:	83 ea 30             	sub    $0x30,%edx
  800368:	89 55 d0             	mov    %edx,-0x30(%ebp)
				ch = *fmt;
  80036b:	0f be 10             	movsbl (%eax),%edx
				if (ch < '0' || ch > '9')
  80036e:	8d 5a d0             	lea    -0x30(%edx),%ebx
  800371:	83 fb 09             	cmp    $0x9,%ebx
  800374:	77 54                	ja     8003ca <vprintfmt+0xed>
  800376:	89 4d e0             	mov    %ecx,-0x20(%ebp)
  800379:	8b 4d d0             	mov    -0x30(%ebp),%ecx
		case '5':
		case '6':
		case '7':
		case '8':
		case '9':
			for (precision = 0; ; ++fmt) {
  80037c:	83 c0 01             	add    $0x1,%eax
				precision = precision * 10 + ch - '0';
  80037f:	8d 0c 89             	lea    (%ecx,%ecx,4),%ecx
  800382:	8d 4c 4a d0          	lea    -0x30(%edx,%ecx,2),%ecx
				ch = *fmt;
  800386:	0f be 10             	movsbl (%eax),%edx
				if (ch < '0' || ch > '9')
  800389:	8d 5a d0             	lea    -0x30(%edx),%ebx
  80038c:	83 fb 09             	cmp    $0x9,%ebx
  80038f:	76 eb                	jbe    80037c <vprintfmt+0x9f>
  800391:	89 4d d0             	mov    %ecx,-0x30(%ebp)
  800394:	8b 4d e0             	mov    -0x20(%ebp),%ecx
  800397:	eb 31                	jmp    8003ca <vprintfmt+0xed>
					break;
			}
			goto process_precision;

		case '*':
			precision = va_arg(ap, int);
  800399:	8b 55 14             	mov    0x14(%ebp),%edx
  80039c:	8d 5a 04             	lea    0x4(%edx),%ebx
  80039f:	89 5d 14             	mov    %ebx,0x14(%ebp)
  8003a2:	8b 12                	mov    (%edx),%edx
  8003a4:	89 55 d0             	mov    %edx,-0x30(%ebp)
			goto process_precision;
  8003a7:	eb 21                	jmp    8003ca <vprintfmt+0xed>

		case '.':
			if (width < 0)
  8003a9:	83 7d e4 00          	cmpl   $0x0,-0x1c(%ebp)
  8003ad:	ba 00 00 00 00       	mov    $0x0,%edx
  8003b2:	0f 49 55 e4          	cmovns -0x1c(%ebp),%edx
  8003b6:	89 55 e4             	mov    %edx,-0x1c(%ebp)
  8003b9:	e9 7a ff ff ff       	jmp    800338 <vprintfmt+0x5b>
  8003be:	c7 45 d8 01 00 00 00 	movl   $0x1,-0x28(%ebp)
				width = 0;
			goto reswitch;

		case '#':
			altflag = 1;
			goto reswitch;
  8003c5:	e9 6e ff ff ff       	jmp    800338 <vprintfmt+0x5b>

		process_precision:
			if (width < 0)
  8003ca:	83 7d e4 00          	cmpl   $0x0,-0x1c(%ebp)
  8003ce:	0f 89 64 ff ff ff    	jns    800338 <vprintfmt+0x5b>
  8003d4:	8b 55 d0             	mov    -0x30(%ebp),%edx
  8003d7:	89 55 e4             	mov    %edx,-0x1c(%ebp)
  8003da:	8b 55 c8             	mov    -0x38(%ebp),%edx
  8003dd:	89 55 d0             	mov    %edx,-0x30(%ebp)
  8003e0:	e9 53 ff ff ff       	jmp    800338 <vprintfmt+0x5b>
				width = precision, precision = -1;
			goto reswitch;

		// long flag (doubled for long long)
		case 'l':
			lflag++;
  8003e5:	83 c1 01             	add    $0x1,%ecx
			goto reswitch;
  8003e8:	e9 4b ff ff ff       	jmp    800338 <vprintfmt+0x5b>
  8003ed:	89 45 cc             	mov    %eax,-0x34(%ebp)

		// character
		case 'c':
			putch(va_arg(ap, int), putdat);
  8003f0:	8b 45 14             	mov    0x14(%ebp),%eax
  8003f3:	8d 50 04             	lea    0x4(%eax),%edx
  8003f6:	89 55 14             	mov    %edx,0x14(%ebp)
  8003f9:	89 74 24 04          	mov    %esi,0x4(%esp)
  8003fd:	8b 00                	mov    (%eax),%eax
  8003ff:	89 04 24             	mov    %eax,(%esp)
  800402:	ff d7                	call   *%edi
  800404:	8b 5d cc             	mov    -0x34(%ebp),%ebx
			break;
  800407:	e9 fd fe ff ff       	jmp    800309 <vprintfmt+0x2c>
  80040c:	89 45 cc             	mov    %eax,-0x34(%ebp)

		// error message
		case 'e':
			err = va_arg(ap, int);
  80040f:	8b 45 14             	mov    0x14(%ebp),%eax
  800412:	8d 50 04             	lea    0x4(%eax),%edx
  800415:	89 55 14             	mov    %edx,0x14(%ebp)
  800418:	8b 00                	mov    (%eax),%eax
  80041a:	89 c2                	mov    %eax,%edx
  80041c:	c1 fa 1f             	sar    $0x1f,%edx
  80041f:	31 d0                	xor    %edx,%eax
  800421:	29 d0                	sub    %edx,%eax
			if (err < 0)
				err = -err;
			if (err > MAXERROR || (p = error_string[err]) == NULL)
  800423:	83 f8 12             	cmp    $0x12,%eax
  800426:	7f 0b                	jg     800433 <vprintfmt+0x156>
  800428:	8b 14 85 e0 2a 80 00 	mov    0x802ae0(,%eax,4),%edx
  80042f:	85 d2                	test   %edx,%edx
  800431:	75 20                	jne    800453 <vprintfmt+0x176>
				printfmt(putch, putdat, "error %d", err);
  800433:	89 44 24 0c          	mov    %eax,0xc(%esp)
  800437:	c7 44 24 08 4d 28 80 	movl   $0x80284d,0x8(%esp)
  80043e:	00 
  80043f:	89 74 24 04          	mov    %esi,0x4(%esp)
  800443:	89 3c 24             	mov    %edi,(%esp)
  800446:	e8 36 03 00 00       	call   800781 <printfmt>
  80044b:	8b 5d cc             	mov    -0x34(%ebp),%ebx
		// error message
		case 'e':
			err = va_arg(ap, int);
			if (err < 0)
				err = -err;
			if (err > MAXERROR || (p = error_string[err]) == NULL)
  80044e:	e9 b6 fe ff ff       	jmp    800309 <vprintfmt+0x2c>
				printfmt(putch, putdat, "error %d", err);
			else
				printfmt(putch, putdat, "%s", p);
  800453:	89 54 24 0c          	mov    %edx,0xc(%esp)
  800457:	c7 44 24 08 32 2c 80 	movl   $0x802c32,0x8(%esp)
  80045e:	00 
  80045f:	89 74 24 04          	mov    %esi,0x4(%esp)
  800463:	89 3c 24             	mov    %edi,(%esp)
  800466:	e8 16 03 00 00       	call   800781 <printfmt>
  80046b:	8b 5d cc             	mov    -0x34(%ebp),%ebx
  80046e:	e9 96 fe ff ff       	jmp    800309 <vprintfmt+0x2c>
  800473:	89 45 cc             	mov    %eax,-0x34(%ebp)
  800476:	89 c3                	mov    %eax,%ebx
  800478:	8b 4d d0             	mov    -0x30(%ebp),%ecx
  80047b:	8b 45 e4             	mov    -0x1c(%ebp),%eax
  80047e:	89 45 c4             	mov    %eax,-0x3c(%ebp)
			break;

		// string
		case 's':
			if ((p = va_arg(ap, char *)) == NULL)
  800481:	8b 45 14             	mov    0x14(%ebp),%eax
  800484:	8d 50 04             	lea    0x4(%eax),%edx
  800487:	89 55 14             	mov    %edx,0x14(%ebp)
  80048a:	8b 00                	mov    (%eax),%eax
  80048c:	89 45 e0             	mov    %eax,-0x20(%ebp)
  80048f:	85 c0                	test   %eax,%eax
  800491:	b8 56 28 80 00       	mov    $0x802856,%eax
  800496:	0f 45 45 e0          	cmovne -0x20(%ebp),%eax
  80049a:	89 45 e0             	mov    %eax,-0x20(%ebp)
				p = "(null)";
			if (width > 0 && padc != '-')
  80049d:	83 7d c4 00          	cmpl   $0x0,-0x3c(%ebp)
  8004a1:	7e 06                	jle    8004a9 <vprintfmt+0x1cc>
  8004a3:	80 7d d4 2d          	cmpb   $0x2d,-0x2c(%ebp)
  8004a7:	75 13                	jne    8004bc <vprintfmt+0x1df>
				for (width -= strnlen(p, precision); width > 0; width--)
					putch(padc, putdat);
			for (; (ch = *p++) != '\0' && (precision < 0 || --precision >= 0); width--)
  8004a9:	8b 55 e0             	mov    -0x20(%ebp),%edx
  8004ac:	0f be 02             	movsbl (%edx),%eax
  8004af:	85 c0                	test   %eax,%eax
  8004b1:	0f 85 9b 00 00 00    	jne    800552 <vprintfmt+0x275>
  8004b7:	e9 88 00 00 00       	jmp    800544 <vprintfmt+0x267>
		// string
		case 's':
			if ((p = va_arg(ap, char *)) == NULL)
				p = "(null)";
			if (width > 0 && padc != '-')
				for (width -= strnlen(p, precision); width > 0; width--)
  8004bc:	89 4c 24 04          	mov    %ecx,0x4(%esp)
  8004c0:	8b 4d e0             	mov    -0x20(%ebp),%ecx
  8004c3:	89 0c 24             	mov    %ecx,(%esp)
  8004c6:	e8 00 03 00 00       	call   8007cb <strnlen>
  8004cb:	8b 55 c4             	mov    -0x3c(%ebp),%edx
  8004ce:	29 c2                	sub    %eax,%edx
  8004d0:	89 55 e4             	mov    %edx,-0x1c(%ebp)
  8004d3:	85 d2                	test   %edx,%edx
  8004d5:	7e d2                	jle    8004a9 <vprintfmt+0x1cc>
					putch(padc, putdat);
  8004d7:	0f be 4d d4          	movsbl -0x2c(%ebp),%ecx
  8004db:	89 4d d4             	mov    %ecx,-0x2c(%ebp)
  8004de:	89 5d c4             	mov    %ebx,-0x3c(%ebp)
  8004e1:	89 d3                	mov    %edx,%ebx
  8004e3:	89 74 24 04          	mov    %esi,0x4(%esp)
  8004e7:	8b 45 d4             	mov    -0x2c(%ebp),%eax
  8004ea:	89 04 24             	mov    %eax,(%esp)
  8004ed:	ff d7                	call   *%edi
		// string
		case 's':
			if ((p = va_arg(ap, char *)) == NULL)
				p = "(null)";
			if (width > 0 && padc != '-')
				for (width -= strnlen(p, precision); width > 0; width--)
  8004ef:	83 eb 01             	sub    $0x1,%ebx
  8004f2:	85 db                	test   %ebx,%ebx
  8004f4:	7f ed                	jg     8004e3 <vprintfmt+0x206>
  8004f6:	8b 5d c4             	mov    -0x3c(%ebp),%ebx
  8004f9:	c7 45 e4 00 00 00 00 	movl   $0x0,-0x1c(%ebp)
  800500:	eb a7                	jmp    8004a9 <vprintfmt+0x1cc>
					putch(padc, putdat);
			for (; (ch = *p++) != '\0' && (precision < 0 || --precision >= 0); width--)
				if (altflag && (ch < ' ' || ch > '~'))
  800502:	83 7d d8 00          	cmpl   $0x0,-0x28(%ebp)
  800506:	74 1a                	je     800522 <vprintfmt+0x245>
  800508:	8d 50 e0             	lea    -0x20(%eax),%edx
  80050b:	83 fa 5e             	cmp    $0x5e,%edx
  80050e:	76 12                	jbe    800522 <vprintfmt+0x245>
					putch('?', putdat);
  800510:	89 7c 24 04          	mov    %edi,0x4(%esp)
  800514:	c7 04 24 3f 00 00 00 	movl   $0x3f,(%esp)
  80051b:	ff 55 e0             	call   *-0x20(%ebp)
				p = "(null)";
			if (width > 0 && padc != '-')
				for (width -= strnlen(p, precision); width > 0; width--)
					putch(padc, putdat);
			for (; (ch = *p++) != '\0' && (precision < 0 || --precision >= 0); width--)
				if (altflag && (ch < ' ' || ch > '~'))
  80051e:	66 90                	xchg   %ax,%ax
  800520:	eb 0a                	jmp    80052c <vprintfmt+0x24f>
					putch('?', putdat);
				else
					putch(ch, putdat);
  800522:	89 7c 24 04          	mov    %edi,0x4(%esp)
  800526:	89 04 24             	mov    %eax,(%esp)
  800529:	ff 55 e0             	call   *-0x20(%ebp)
			if ((p = va_arg(ap, char *)) == NULL)
				p = "(null)";
			if (width > 0 && padc != '-')
				for (width -= strnlen(p, precision); width > 0; width--)
					putch(padc, putdat);
			for (; (ch = *p++) != '\0' && (precision < 0 || --precision >= 0); width--)
  80052c:	83 6d e4 01          	subl   $0x1,-0x1c(%ebp)
  800530:	0f be 03             	movsbl (%ebx),%eax
  800533:	85 c0                	test   %eax,%eax
  800535:	74 05                	je     80053c <vprintfmt+0x25f>
  800537:	83 c3 01             	add    $0x1,%ebx
  80053a:	eb 29                	jmp    800565 <vprintfmt+0x288>
  80053c:	89 fe                	mov    %edi,%esi
  80053e:	8b 7d e0             	mov    -0x20(%ebp),%edi
  800541:	8b 5d d0             	mov    -0x30(%ebp),%ebx
				if (altflag && (ch < ' ' || ch > '~'))
					putch('?', putdat);
				else
					putch(ch, putdat);
			for (; width > 0; width--)
  800544:	83 7d e4 00          	cmpl   $0x0,-0x1c(%ebp)
  800548:	7f 2e                	jg     800578 <vprintfmt+0x29b>
  80054a:	8b 5d cc             	mov    -0x34(%ebp),%ebx
  80054d:	e9 b7 fd ff ff       	jmp    800309 <vprintfmt+0x2c>
			if ((p = va_arg(ap, char *)) == NULL)
				p = "(null)";
			if (width > 0 && padc != '-')
				for (width -= strnlen(p, precision); width > 0; width--)
					putch(padc, putdat);
			for (; (ch = *p++) != '\0' && (precision < 0 || --precision >= 0); width--)
  800552:	8b 55 e0             	mov    -0x20(%ebp),%edx
  800555:	83 c2 01             	add    $0x1,%edx
  800558:	89 7d e0             	mov    %edi,-0x20(%ebp)
  80055b:	89 f7                	mov    %esi,%edi
  80055d:	8b 75 d0             	mov    -0x30(%ebp),%esi
  800560:	89 5d d0             	mov    %ebx,-0x30(%ebp)
  800563:	89 d3                	mov    %edx,%ebx
  800565:	85 f6                	test   %esi,%esi
  800567:	78 99                	js     800502 <vprintfmt+0x225>
  800569:	83 ee 01             	sub    $0x1,%esi
  80056c:	79 94                	jns    800502 <vprintfmt+0x225>
  80056e:	89 fe                	mov    %edi,%esi
  800570:	8b 7d e0             	mov    -0x20(%ebp),%edi
  800573:	8b 5d d0             	mov    -0x30(%ebp),%ebx
  800576:	eb cc                	jmp    800544 <vprintfmt+0x267>
  800578:	89 5d d8             	mov    %ebx,-0x28(%ebp)
  80057b:	8b 5d e4             	mov    -0x1c(%ebp),%ebx
				if (altflag && (ch < ' ' || ch > '~'))
					putch('?', putdat);
				else
					putch(ch, putdat);
			for (; width > 0; width--)
				putch(' ', putdat);
  80057e:	89 74 24 04          	mov    %esi,0x4(%esp)
  800582:	c7 04 24 20 00 00 00 	movl   $0x20,(%esp)
  800589:	ff d7                	call   *%edi
			for (; (ch = *p++) != '\0' && (precision < 0 || --precision >= 0); width--)
				if (altflag && (ch < ' ' || ch > '~'))
					putch('?', putdat);
				else
					putch(ch, putdat);
			for (; width > 0; width--)
  80058b:	83 eb 01             	sub    $0x1,%ebx
  80058e:	85 db                	test   %ebx,%ebx
  800590:	7f ec                	jg     80057e <vprintfmt+0x2a1>
  800592:	8b 5d d8             	mov    -0x28(%ebp),%ebx
  800595:	e9 6f fd ff ff       	jmp    800309 <vprintfmt+0x2c>
  80059a:	89 45 cc             	mov    %eax,-0x34(%ebp)
// Same as getuint but signed - can't use getuint
// because of sign extension
static long long
getint(va_list *ap, int lflag)
{
	if (lflag >= 2)
  80059d:	83 f9 01             	cmp    $0x1,%ecx
  8005a0:	7e 16                	jle    8005b8 <vprintfmt+0x2db>
		return va_arg(*ap, long long);
  8005a2:	8b 45 14             	mov    0x14(%ebp),%eax
  8005a5:	8d 50 08             	lea    0x8(%eax),%edx
  8005a8:	89 55 14             	mov    %edx,0x14(%ebp)
  8005ab:	8b 10                	mov    (%eax),%edx
  8005ad:	8b 48 04             	mov    0x4(%eax),%ecx
  8005b0:	89 55 d8             	mov    %edx,-0x28(%ebp)
  8005b3:	89 4d dc             	mov    %ecx,-0x24(%ebp)
  8005b6:	eb 32                	jmp    8005ea <vprintfmt+0x30d>
	else if (lflag)
  8005b8:	85 c9                	test   %ecx,%ecx
  8005ba:	74 18                	je     8005d4 <vprintfmt+0x2f7>
		return va_arg(*ap, long);
  8005bc:	8b 45 14             	mov    0x14(%ebp),%eax
  8005bf:	8d 50 04             	lea    0x4(%eax),%edx
  8005c2:	89 55 14             	mov    %edx,0x14(%ebp)
  8005c5:	8b 00                	mov    (%eax),%eax
  8005c7:	89 45 d8             	mov    %eax,-0x28(%ebp)
  8005ca:	89 c1                	mov    %eax,%ecx
  8005cc:	c1 f9 1f             	sar    $0x1f,%ecx
  8005cf:	89 4d dc             	mov    %ecx,-0x24(%ebp)
  8005d2:	eb 16                	jmp    8005ea <vprintfmt+0x30d>
	else
		return va_arg(*ap, int);
  8005d4:	8b 45 14             	mov    0x14(%ebp),%eax
  8005d7:	8d 50 04             	lea    0x4(%eax),%edx
  8005da:	89 55 14             	mov    %edx,0x14(%ebp)
  8005dd:	8b 00                	mov    (%eax),%eax
  8005df:	89 45 d8             	mov    %eax,-0x28(%ebp)
  8005e2:	89 c2                	mov    %eax,%edx
  8005e4:	c1 fa 1f             	sar    $0x1f,%edx
  8005e7:	89 55 dc             	mov    %edx,-0x24(%ebp)
				putch(' ', putdat);
			break;

		// (signed) decimal
		case 'd':
			num = getint(&ap, lflag);
  8005ea:	8b 4d d8             	mov    -0x28(%ebp),%ecx
  8005ed:	8b 5d dc             	mov    -0x24(%ebp),%ebx
  8005f0:	b8 0a 00 00 00       	mov    $0xa,%eax
			if ((long long) num < 0) {
  8005f5:	83 7d dc 00          	cmpl   $0x0,-0x24(%ebp)
  8005f9:	0f 89 9b 00 00 00    	jns    80069a <vprintfmt+0x3bd>
				putch('-', putdat);
  8005ff:	89 74 24 04          	mov    %esi,0x4(%esp)
  800603:	c7 04 24 2d 00 00 00 	movl   $0x2d,(%esp)
  80060a:	ff d7                	call   *%edi
				num = -(long long) num;
  80060c:	8b 4d d8             	mov    -0x28(%ebp),%ecx
  80060f:	8b 5d dc             	mov    -0x24(%ebp),%ebx
  800612:	f7 d9                	neg    %ecx
  800614:	83 d3 00             	adc    $0x0,%ebx
  800617:	f7 db                	neg    %ebx
  800619:	b8 0a 00 00 00       	mov    $0xa,%eax
  80061e:	eb 7a                	jmp    80069a <vprintfmt+0x3bd>
  800620:	89 45 cc             	mov    %eax,-0x34(%ebp)
			base = 10;
			goto number;

		// unsigned decimal
		case 'u':
			num = getuint(&ap, lflag);
  800623:	89 ca                	mov    %ecx,%edx
  800625:	8d 45 14             	lea    0x14(%ebp),%eax
  800628:	e8 59 fc ff ff       	call   800286 <getuint>
  80062d:	89 c1                	mov    %eax,%ecx
  80062f:	89 d3                	mov    %edx,%ebx
  800631:	b8 0a 00 00 00       	mov    $0xa,%eax
			base = 10;
			goto number;
  800636:	eb 62                	jmp    80069a <vprintfmt+0x3bd>
  800638:	89 45 cc             	mov    %eax,-0x34(%ebp)

		// (unsigned) octal
		case 'o':
			num = getuint(&ap, lflag);
  80063b:	89 ca                	mov    %ecx,%edx
  80063d:	8d 45 14             	lea    0x14(%ebp),%eax
  800640:	e8 41 fc ff ff       	call   800286 <getuint>
  800645:	89 c1                	mov    %eax,%ecx
  800647:	89 d3                	mov    %edx,%ebx
  800649:	b8 08 00 00 00       	mov    $0x8,%eax
			base = 8;
			goto number;
  80064e:	eb 4a                	jmp    80069a <vprintfmt+0x3bd>
  800650:	89 45 cc             	mov    %eax,-0x34(%ebp)
			break;
			**/

		// pointer
		case 'p':
			putch('0', putdat);
  800653:	89 74 24 04          	mov    %esi,0x4(%esp)
  800657:	c7 04 24 30 00 00 00 	movl   $0x30,(%esp)
  80065e:	ff d7                	call   *%edi
			putch('x', putdat);
  800660:	89 74 24 04          	mov    %esi,0x4(%esp)
  800664:	c7 04 24 78 00 00 00 	movl   $0x78,(%esp)
  80066b:	ff d7                	call   *%edi
			num = (unsigned long long)
  80066d:	8b 45 14             	mov    0x14(%ebp),%eax
  800670:	8d 50 04             	lea    0x4(%eax),%edx
  800673:	89 55 14             	mov    %edx,0x14(%ebp)
  800676:	8b 08                	mov    (%eax),%ecx
  800678:	bb 00 00 00 00       	mov    $0x0,%ebx
  80067d:	b8 10 00 00 00       	mov    $0x10,%eax
				(uintptr_t) va_arg(ap, void *);
			base = 16;
			goto number;
  800682:	eb 16                	jmp    80069a <vprintfmt+0x3bd>
  800684:	89 45 cc             	mov    %eax,-0x34(%ebp)

		// (unsigned) hexadecimal
		case 'x':
			num = getuint(&ap, lflag);
  800687:	89 ca                	mov    %ecx,%edx
  800689:	8d 45 14             	lea    0x14(%ebp),%eax
  80068c:	e8 f5 fb ff ff       	call   800286 <getuint>
  800691:	89 c1                	mov    %eax,%ecx
  800693:	89 d3                	mov    %edx,%ebx
  800695:	b8 10 00 00 00       	mov    $0x10,%eax
			base = 16;
		number:
			printnum(putch, putdat, num, base, width, padc);
  80069a:	0f be 55 d4          	movsbl -0x2c(%ebp),%edx
  80069e:	89 54 24 10          	mov    %edx,0x10(%esp)
  8006a2:	8b 55 e4             	mov    -0x1c(%ebp),%edx
  8006a5:	89 54 24 0c          	mov    %edx,0xc(%esp)
  8006a9:	89 44 24 08          	mov    %eax,0x8(%esp)
  8006ad:	89 0c 24             	mov    %ecx,(%esp)
  8006b0:	89 5c 24 04          	mov    %ebx,0x4(%esp)
  8006b4:	89 f2                	mov    %esi,%edx
  8006b6:	89 f8                	mov    %edi,%eax
  8006b8:	e8 d3 fa ff ff       	call   800190 <printnum>
  8006bd:	8b 5d cc             	mov    -0x34(%ebp),%ebx
			break;
  8006c0:	e9 44 fc ff ff       	jmp    800309 <vprintfmt+0x2c>
  8006c5:	89 45 cc             	mov    %eax,-0x34(%ebp)
  8006c8:	8b 55 e0             	mov    -0x20(%ebp),%edx

		// escaped '%' character
		case '%':
			putch(ch, putdat);
  8006cb:	89 74 24 04          	mov    %esi,0x4(%esp)
  8006cf:	89 14 24             	mov    %edx,(%esp)
  8006d2:	ff d7                	call   *%edi
  8006d4:	8b 5d cc             	mov    -0x34(%ebp),%ebx
			break;
  8006d7:	e9 2d fc ff ff       	jmp    800309 <vprintfmt+0x2c>
			
		// unrecognized escape sequence - just print it literally
		default:
			putch('%', putdat);
  8006dc:	89 74 24 04          	mov    %esi,0x4(%esp)
  8006e0:	c7 04 24 25 00 00 00 	movl   $0x25,(%esp)
  8006e7:	ff d7                	call   *%edi
			for (fmt--; fmt[-1] != '%'; fmt--)
  8006e9:	8d 43 ff             	lea    -0x1(%ebx),%eax
  8006ec:	80 38 25             	cmpb   $0x25,(%eax)
  8006ef:	0f 84 14 fc ff ff    	je     800309 <vprintfmt+0x2c>
  8006f5:	89 c3                	mov    %eax,%ebx
  8006f7:	eb f0                	jmp    8006e9 <vprintfmt+0x40c>
				/* do nothing */;
			break;
		}
	}
}
  8006f9:	83 c4 5c             	add    $0x5c,%esp
  8006fc:	5b                   	pop    %ebx
  8006fd:	5e                   	pop    %esi
  8006fe:	5f                   	pop    %edi
  8006ff:	5d                   	pop    %ebp
  800700:	c3                   	ret    

00800701 <vsnprintf>:
		*b->buf++ = ch;
}

int
vsnprintf(char *buf, int n, const char *fmt, va_list ap)
{
  800701:	55                   	push   %ebp
  800702:	89 e5                	mov    %esp,%ebp
  800704:	83 ec 28             	sub    $0x28,%esp
  800707:	8b 45 08             	mov    0x8(%ebp),%eax
  80070a:	8b 55 0c             	mov    0xc(%ebp),%edx
	struct sprintbuf b = {buf, buf+n-1, 0};

	if (buf == NULL || n < 1)
  80070d:	85 c0                	test   %eax,%eax
  80070f:	74 04                	je     800715 <vsnprintf+0x14>
  800711:	85 d2                	test   %edx,%edx
  800713:	7f 07                	jg     80071c <vsnprintf+0x1b>
  800715:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  80071a:	eb 3b                	jmp    800757 <vsnprintf+0x56>
}

int
vsnprintf(char *buf, int n, const char *fmt, va_list ap)
{
	struct sprintbuf b = {buf, buf+n-1, 0};
  80071c:	89 45 ec             	mov    %eax,-0x14(%ebp)
  80071f:	8d 44 10 ff          	lea    -0x1(%eax,%edx,1),%eax
  800723:	89 45 f0             	mov    %eax,-0x10(%ebp)
  800726:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)

	if (buf == NULL || n < 1)
		return -E_INVAL;

	// print the string to the buffer
	vprintfmt((void*)sprintputch, &b, fmt, ap);
  80072d:	8b 45 14             	mov    0x14(%ebp),%eax
  800730:	89 44 24 0c          	mov    %eax,0xc(%esp)
  800734:	8b 45 10             	mov    0x10(%ebp),%eax
  800737:	89 44 24 08          	mov    %eax,0x8(%esp)
  80073b:	8d 45 ec             	lea    -0x14(%ebp),%eax
  80073e:	89 44 24 04          	mov    %eax,0x4(%esp)
  800742:	c7 04 24 c0 02 80 00 	movl   $0x8002c0,(%esp)
  800749:	e8 8f fb ff ff       	call   8002dd <vprintfmt>

	// null terminate the buffer
	*b.buf = '\0';
  80074e:	8b 45 ec             	mov    -0x14(%ebp),%eax
  800751:	c6 00 00             	movb   $0x0,(%eax)

	return b.cnt;
  800754:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
  800757:	c9                   	leave  
  800758:	c3                   	ret    

00800759 <snprintf>:

int
snprintf(char *buf, int n, const char *fmt, ...)
{
  800759:	55                   	push   %ebp
  80075a:	89 e5                	mov    %esp,%ebp
  80075c:	83 ec 18             	sub    $0x18,%esp

	return b.cnt;
}

int
snprintf(char *buf, int n, const char *fmt, ...)
  80075f:	8d 45 14             	lea    0x14(%ebp),%eax
{
	va_list ap;
	int rc;

	va_start(ap, fmt);
	rc = vsnprintf(buf, n, fmt, ap);
  800762:	89 44 24 0c          	mov    %eax,0xc(%esp)
  800766:	8b 45 10             	mov    0x10(%ebp),%eax
  800769:	89 44 24 08          	mov    %eax,0x8(%esp)
  80076d:	8b 45 0c             	mov    0xc(%ebp),%eax
  800770:	89 44 24 04          	mov    %eax,0x4(%esp)
  800774:	8b 45 08             	mov    0x8(%ebp),%eax
  800777:	89 04 24             	mov    %eax,(%esp)
  80077a:	e8 82 ff ff ff       	call   800701 <vsnprintf>
	va_end(ap);

	return rc;
}
  80077f:	c9                   	leave  
  800780:	c3                   	ret    

00800781 <printfmt>:
	}
}

void
printfmt(void (*putch)(int, void*), void *putdat, const char *fmt, ...)
{
  800781:	55                   	push   %ebp
  800782:	89 e5                	mov    %esp,%ebp
  800784:	83 ec 18             	sub    $0x18,%esp
		}
	}
}

void
printfmt(void (*putch)(int, void*), void *putdat, const char *fmt, ...)
  800787:	8d 45 14             	lea    0x14(%ebp),%eax
{
	va_list ap;

	va_start(ap, fmt);
	vprintfmt(putch, putdat, fmt, ap);
  80078a:	89 44 24 0c          	mov    %eax,0xc(%esp)
  80078e:	8b 45 10             	mov    0x10(%ebp),%eax
  800791:	89 44 24 08          	mov    %eax,0x8(%esp)
  800795:	8b 45 0c             	mov    0xc(%ebp),%eax
  800798:	89 44 24 04          	mov    %eax,0x4(%esp)
  80079c:	8b 45 08             	mov    0x8(%ebp),%eax
  80079f:	89 04 24             	mov    %eax,(%esp)
  8007a2:	e8 36 fb ff ff       	call   8002dd <vprintfmt>
	va_end(ap);
}
  8007a7:	c9                   	leave  
  8007a8:	c3                   	ret    
  8007a9:	00 00                	add    %al,(%eax)
  8007ab:	00 00                	add    %al,(%eax)
  8007ad:	00 00                	add    %al,(%eax)
	...

008007b0 <strlen>:
// Primespipe runs 3x faster this way.
#define ASM 1

int
strlen(const char *s)
{
  8007b0:	55                   	push   %ebp
  8007b1:	89 e5                	mov    %esp,%ebp
  8007b3:	8b 55 08             	mov    0x8(%ebp),%edx
	int n;

	for (n = 0; *s != '\0'; s++)
  8007b6:	b8 00 00 00 00       	mov    $0x0,%eax
  8007bb:	80 3a 00             	cmpb   $0x0,(%edx)
  8007be:	74 09                	je     8007c9 <strlen+0x19>
		n++;
  8007c0:	83 c0 01             	add    $0x1,%eax
int
strlen(const char *s)
{
	int n;

	for (n = 0; *s != '\0'; s++)
  8007c3:	80 3c 02 00          	cmpb   $0x0,(%edx,%eax,1)
  8007c7:	75 f7                	jne    8007c0 <strlen+0x10>
		n++;
	return n;
}
  8007c9:	5d                   	pop    %ebp
  8007ca:	c3                   	ret    

008007cb <strnlen>:

int
strnlen(const char *s, size_t size)
{
  8007cb:	55                   	push   %ebp
  8007cc:	89 e5                	mov    %esp,%ebp
  8007ce:	53                   	push   %ebx
  8007cf:	8b 5d 08             	mov    0x8(%ebp),%ebx
  8007d2:	8b 4d 0c             	mov    0xc(%ebp),%ecx
	int n;

	for (n = 0; size > 0 && *s != '\0'; s++, size--)
  8007d5:	85 c9                	test   %ecx,%ecx
  8007d7:	74 19                	je     8007f2 <strnlen+0x27>
  8007d9:	80 3b 00             	cmpb   $0x0,(%ebx)
  8007dc:	74 14                	je     8007f2 <strnlen+0x27>
  8007de:	b8 00 00 00 00       	mov    $0x0,%eax
		n++;
  8007e3:	83 c0 01             	add    $0x1,%eax
int
strnlen(const char *s, size_t size)
{
	int n;

	for (n = 0; size > 0 && *s != '\0'; s++, size--)
  8007e6:	39 c8                	cmp    %ecx,%eax
  8007e8:	74 0d                	je     8007f7 <strnlen+0x2c>
  8007ea:	80 3c 03 00          	cmpb   $0x0,(%ebx,%eax,1)
  8007ee:	75 f3                	jne    8007e3 <strnlen+0x18>
  8007f0:	eb 05                	jmp    8007f7 <strnlen+0x2c>
  8007f2:	b8 00 00 00 00       	mov    $0x0,%eax
		n++;
	return n;
}
  8007f7:	5b                   	pop    %ebx
  8007f8:	5d                   	pop    %ebp
  8007f9:	c3                   	ret    

008007fa <strcpy>:

char *
strcpy(char *dst, const char *src)
{
  8007fa:	55                   	push   %ebp
  8007fb:	89 e5                	mov    %esp,%ebp
  8007fd:	53                   	push   %ebx
  8007fe:	8b 45 08             	mov    0x8(%ebp),%eax
  800801:	8b 5d 0c             	mov    0xc(%ebp),%ebx
  800804:	ba 00 00 00 00       	mov    $0x0,%edx
	char *ret;

	ret = dst;
	while ((*dst++ = *src++) != '\0')
  800809:	0f b6 0c 13          	movzbl (%ebx,%edx,1),%ecx
  80080d:	88 0c 10             	mov    %cl,(%eax,%edx,1)
  800810:	83 c2 01             	add    $0x1,%edx
  800813:	84 c9                	test   %cl,%cl
  800815:	75 f2                	jne    800809 <strcpy+0xf>
		/* do nothing */;
	return ret;
}
  800817:	5b                   	pop    %ebx
  800818:	5d                   	pop    %ebp
  800819:	c3                   	ret    

0080081a <strncpy>:

char *
strncpy(char *dst, const char *src, size_t size) {
  80081a:	55                   	push   %ebp
  80081b:	89 e5                	mov    %esp,%ebp
  80081d:	56                   	push   %esi
  80081e:	53                   	push   %ebx
  80081f:	8b 45 08             	mov    0x8(%ebp),%eax
  800822:	8b 55 0c             	mov    0xc(%ebp),%edx
  800825:	8b 75 10             	mov    0x10(%ebp),%esi
	size_t i;
	char *ret;

	ret = dst;
	for (i = 0; i < size; i++) {
  800828:	85 f6                	test   %esi,%esi
  80082a:	74 18                	je     800844 <strncpy+0x2a>
  80082c:	b9 00 00 00 00       	mov    $0x0,%ecx
		*dst++ = *src;
  800831:	0f b6 1a             	movzbl (%edx),%ebx
  800834:	88 1c 08             	mov    %bl,(%eax,%ecx,1)
		// If strlen(src) < size, null-pad 'dst' out to 'size' chars
		if (*src != '\0')
			src++;
  800837:	80 3a 01             	cmpb   $0x1,(%edx)
  80083a:	83 da ff             	sbb    $0xffffffff,%edx
strncpy(char *dst, const char *src, size_t size) {
	size_t i;
	char *ret;

	ret = dst;
	for (i = 0; i < size; i++) {
  80083d:	83 c1 01             	add    $0x1,%ecx
  800840:	39 ce                	cmp    %ecx,%esi
  800842:	77 ed                	ja     800831 <strncpy+0x17>
		// If strlen(src) < size, null-pad 'dst' out to 'size' chars
		if (*src != '\0')
			src++;
	}
	return ret;
}
  800844:	5b                   	pop    %ebx
  800845:	5e                   	pop    %esi
  800846:	5d                   	pop    %ebp
  800847:	c3                   	ret    

00800848 <strlcpy>:

size_t
strlcpy(char *dst, const char *src, size_t size)
{
  800848:	55                   	push   %ebp
  800849:	89 e5                	mov    %esp,%ebp
  80084b:	56                   	push   %esi
  80084c:	53                   	push   %ebx
  80084d:	8b 75 08             	mov    0x8(%ebp),%esi
  800850:	8b 55 0c             	mov    0xc(%ebp),%edx
  800853:	8b 4d 10             	mov    0x10(%ebp),%ecx
	char *dst_in;

	dst_in = dst;
	if (size > 0) {
  800856:	89 f0                	mov    %esi,%eax
  800858:	85 c9                	test   %ecx,%ecx
  80085a:	74 27                	je     800883 <strlcpy+0x3b>
		while (--size > 0 && *src != '\0')
  80085c:	83 e9 01             	sub    $0x1,%ecx
  80085f:	74 1d                	je     80087e <strlcpy+0x36>
  800861:	0f b6 1a             	movzbl (%edx),%ebx
  800864:	84 db                	test   %bl,%bl
  800866:	74 16                	je     80087e <strlcpy+0x36>
			*dst++ = *src++;
  800868:	88 18                	mov    %bl,(%eax)
  80086a:	83 c0 01             	add    $0x1,%eax
{
	char *dst_in;

	dst_in = dst;
	if (size > 0) {
		while (--size > 0 && *src != '\0')
  80086d:	83 e9 01             	sub    $0x1,%ecx
  800870:	74 0e                	je     800880 <strlcpy+0x38>
			*dst++ = *src++;
  800872:	83 c2 01             	add    $0x1,%edx
{
	char *dst_in;

	dst_in = dst;
	if (size > 0) {
		while (--size > 0 && *src != '\0')
  800875:	0f b6 1a             	movzbl (%edx),%ebx
  800878:	84 db                	test   %bl,%bl
  80087a:	75 ec                	jne    800868 <strlcpy+0x20>
  80087c:	eb 02                	jmp    800880 <strlcpy+0x38>
  80087e:	89 f0                	mov    %esi,%eax
			*dst++ = *src++;
		*dst = '\0';
  800880:	c6 00 00             	movb   $0x0,(%eax)
  800883:	29 f0                	sub    %esi,%eax
	}
	return dst - dst_in;
}
  800885:	5b                   	pop    %ebx
  800886:	5e                   	pop    %esi
  800887:	5d                   	pop    %ebp
  800888:	c3                   	ret    

00800889 <strcmp>:

int
strcmp(const char *p, const char *q)
{
  800889:	55                   	push   %ebp
  80088a:	89 e5                	mov    %esp,%ebp
  80088c:	8b 4d 08             	mov    0x8(%ebp),%ecx
  80088f:	8b 55 0c             	mov    0xc(%ebp),%edx
	while (*p && *p == *q)
  800892:	0f b6 01             	movzbl (%ecx),%eax
  800895:	84 c0                	test   %al,%al
  800897:	74 15                	je     8008ae <strcmp+0x25>
  800899:	3a 02                	cmp    (%edx),%al
  80089b:	75 11                	jne    8008ae <strcmp+0x25>
		p++, q++;
  80089d:	83 c1 01             	add    $0x1,%ecx
  8008a0:	83 c2 01             	add    $0x1,%edx
}

int
strcmp(const char *p, const char *q)
{
	while (*p && *p == *q)
  8008a3:	0f b6 01             	movzbl (%ecx),%eax
  8008a6:	84 c0                	test   %al,%al
  8008a8:	74 04                	je     8008ae <strcmp+0x25>
  8008aa:	3a 02                	cmp    (%edx),%al
  8008ac:	74 ef                	je     80089d <strcmp+0x14>
  8008ae:	0f b6 c0             	movzbl %al,%eax
  8008b1:	0f b6 12             	movzbl (%edx),%edx
  8008b4:	29 d0                	sub    %edx,%eax
		p++, q++;
	return (int) ((unsigned char) *p - (unsigned char) *q);
}
  8008b6:	5d                   	pop    %ebp
  8008b7:	c3                   	ret    

008008b8 <strncmp>:

int
strncmp(const char *p, const char *q, size_t n)
{
  8008b8:	55                   	push   %ebp
  8008b9:	89 e5                	mov    %esp,%ebp
  8008bb:	53                   	push   %ebx
  8008bc:	8b 55 08             	mov    0x8(%ebp),%edx
  8008bf:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  8008c2:	8b 45 10             	mov    0x10(%ebp),%eax
	while (n > 0 && *p && *p == *q)
  8008c5:	85 c0                	test   %eax,%eax
  8008c7:	74 23                	je     8008ec <strncmp+0x34>
  8008c9:	0f b6 1a             	movzbl (%edx),%ebx
  8008cc:	84 db                	test   %bl,%bl
  8008ce:	74 24                	je     8008f4 <strncmp+0x3c>
  8008d0:	3a 19                	cmp    (%ecx),%bl
  8008d2:	75 20                	jne    8008f4 <strncmp+0x3c>
  8008d4:	83 e8 01             	sub    $0x1,%eax
  8008d7:	74 13                	je     8008ec <strncmp+0x34>
		n--, p++, q++;
  8008d9:	83 c2 01             	add    $0x1,%edx
  8008dc:	83 c1 01             	add    $0x1,%ecx
}

int
strncmp(const char *p, const char *q, size_t n)
{
	while (n > 0 && *p && *p == *q)
  8008df:	0f b6 1a             	movzbl (%edx),%ebx
  8008e2:	84 db                	test   %bl,%bl
  8008e4:	74 0e                	je     8008f4 <strncmp+0x3c>
  8008e6:	3a 19                	cmp    (%ecx),%bl
  8008e8:	74 ea                	je     8008d4 <strncmp+0x1c>
  8008ea:	eb 08                	jmp    8008f4 <strncmp+0x3c>
  8008ec:	b8 00 00 00 00       	mov    $0x0,%eax
		n--, p++, q++;
	if (n == 0)
		return 0;
	else
		return (int) ((unsigned char) *p - (unsigned char) *q);
}
  8008f1:	5b                   	pop    %ebx
  8008f2:	5d                   	pop    %ebp
  8008f3:	c3                   	ret    
	while (n > 0 && *p && *p == *q)
		n--, p++, q++;
	if (n == 0)
		return 0;
	else
		return (int) ((unsigned char) *p - (unsigned char) *q);
  8008f4:	0f b6 02             	movzbl (%edx),%eax
  8008f7:	0f b6 11             	movzbl (%ecx),%edx
  8008fa:	29 d0                	sub    %edx,%eax
  8008fc:	eb f3                	jmp    8008f1 <strncmp+0x39>

008008fe <strchr>:

// Return a pointer to the first occurrence of 'c' in 's',
// or a null pointer if the string has no 'c'.
char *
strchr(const char *s, char c)
{
  8008fe:	55                   	push   %ebp
  8008ff:	89 e5                	mov    %esp,%ebp
  800901:	8b 45 08             	mov    0x8(%ebp),%eax
  800904:	0f b6 4d 0c          	movzbl 0xc(%ebp),%ecx
	for (; *s; s++)
  800908:	0f b6 10             	movzbl (%eax),%edx
  80090b:	84 d2                	test   %dl,%dl
  80090d:	74 15                	je     800924 <strchr+0x26>
		if (*s == c)
  80090f:	38 ca                	cmp    %cl,%dl
  800911:	75 07                	jne    80091a <strchr+0x1c>
  800913:	eb 14                	jmp    800929 <strchr+0x2b>
  800915:	38 ca                	cmp    %cl,%dl
  800917:	90                   	nop
  800918:	74 0f                	je     800929 <strchr+0x2b>
// Return a pointer to the first occurrence of 'c' in 's',
// or a null pointer if the string has no 'c'.
char *
strchr(const char *s, char c)
{
	for (; *s; s++)
  80091a:	83 c0 01             	add    $0x1,%eax
  80091d:	0f b6 10             	movzbl (%eax),%edx
  800920:	84 d2                	test   %dl,%dl
  800922:	75 f1                	jne    800915 <strchr+0x17>
  800924:	b8 00 00 00 00       	mov    $0x0,%eax
		if (*s == c)
			return (char *) s;
	return 0;
}
  800929:	5d                   	pop    %ebp
  80092a:	c3                   	ret    

0080092b <strfind>:

// Return a pointer to the first occurrence of 'c' in 's',
// or a pointer to the string-ending null character if the string has no 'c'.
char *
strfind(const char *s, char c)
{
  80092b:	55                   	push   %ebp
  80092c:	89 e5                	mov    %esp,%ebp
  80092e:	8b 45 08             	mov    0x8(%ebp),%eax
  800931:	0f b6 4d 0c          	movzbl 0xc(%ebp),%ecx
	for (; *s; s++)
  800935:	0f b6 10             	movzbl (%eax),%edx
  800938:	84 d2                	test   %dl,%dl
  80093a:	74 18                	je     800954 <strfind+0x29>
		if (*s == c)
  80093c:	38 ca                	cmp    %cl,%dl
  80093e:	75 0a                	jne    80094a <strfind+0x1f>
  800940:	eb 12                	jmp    800954 <strfind+0x29>
  800942:	38 ca                	cmp    %cl,%dl
  800944:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi
  800948:	74 0a                	je     800954 <strfind+0x29>
// Return a pointer to the first occurrence of 'c' in 's',
// or a pointer to the string-ending null character if the string has no 'c'.
char *
strfind(const char *s, char c)
{
	for (; *s; s++)
  80094a:	83 c0 01             	add    $0x1,%eax
  80094d:	0f b6 10             	movzbl (%eax),%edx
  800950:	84 d2                	test   %dl,%dl
  800952:	75 ee                	jne    800942 <strfind+0x17>
		if (*s == c)
			break;
	return (char *) s;
}
  800954:	5d                   	pop    %ebp
  800955:	c3                   	ret    

00800956 <memset>:

#if ASM
void *
memset(void *v, int c, size_t n)
{
  800956:	55                   	push   %ebp
  800957:	89 e5                	mov    %esp,%ebp
  800959:	83 ec 0c             	sub    $0xc,%esp
  80095c:	89 1c 24             	mov    %ebx,(%esp)
  80095f:	89 74 24 04          	mov    %esi,0x4(%esp)
  800963:	89 7c 24 08          	mov    %edi,0x8(%esp)
  800967:	8b 7d 08             	mov    0x8(%ebp),%edi
  80096a:	8b 45 0c             	mov    0xc(%ebp),%eax
  80096d:	8b 4d 10             	mov    0x10(%ebp),%ecx
	char *p;

	if (n == 0)
  800970:	85 c9                	test   %ecx,%ecx
  800972:	74 30                	je     8009a4 <memset+0x4e>
		return v;
	if ((int)v%4 == 0 && n%4 == 0) {
  800974:	f7 c7 03 00 00 00    	test   $0x3,%edi
  80097a:	75 25                	jne    8009a1 <memset+0x4b>
  80097c:	f6 c1 03             	test   $0x3,%cl
  80097f:	75 20                	jne    8009a1 <memset+0x4b>
		c &= 0xFF;
  800981:	0f b6 d0             	movzbl %al,%edx
		c = (c<<24)|(c<<16)|(c<<8)|c;
  800984:	89 d3                	mov    %edx,%ebx
  800986:	c1 e3 08             	shl    $0x8,%ebx
  800989:	89 d6                	mov    %edx,%esi
  80098b:	c1 e6 18             	shl    $0x18,%esi
  80098e:	89 d0                	mov    %edx,%eax
  800990:	c1 e0 10             	shl    $0x10,%eax
  800993:	09 f0                	or     %esi,%eax
  800995:	09 d0                	or     %edx,%eax
		asm volatile("cld; rep stosl\n"
  800997:	09 d8                	or     %ebx,%eax
  800999:	c1 e9 02             	shr    $0x2,%ecx
  80099c:	fc                   	cld    
  80099d:	f3 ab                	rep stos %eax,%es:(%edi)
{
	char *p;

	if (n == 0)
		return v;
	if ((int)v%4 == 0 && n%4 == 0) {
  80099f:	eb 03                	jmp    8009a4 <memset+0x4e>
		c = (c<<24)|(c<<16)|(c<<8)|c;
		asm volatile("cld; rep stosl\n"
			:: "D" (v), "a" (c), "c" (n/4)
			: "cc", "memory");
	} else
		asm volatile("cld; rep stosb\n"
  8009a1:	fc                   	cld    
  8009a2:	f3 aa                	rep stos %al,%es:(%edi)
			:: "D" (v), "a" (c), "c" (n)
			: "cc", "memory");
	return v;
}
  8009a4:	89 f8                	mov    %edi,%eax
  8009a6:	8b 1c 24             	mov    (%esp),%ebx
  8009a9:	8b 74 24 04          	mov    0x4(%esp),%esi
  8009ad:	8b 7c 24 08          	mov    0x8(%esp),%edi
  8009b1:	89 ec                	mov    %ebp,%esp
  8009b3:	5d                   	pop    %ebp
  8009b4:	c3                   	ret    

008009b5 <memmove>:

void *
memmove(void *dst, const void *src, size_t n)
{
  8009b5:	55                   	push   %ebp
  8009b6:	89 e5                	mov    %esp,%ebp
  8009b8:	83 ec 08             	sub    $0x8,%esp
  8009bb:	89 34 24             	mov    %esi,(%esp)
  8009be:	89 7c 24 04          	mov    %edi,0x4(%esp)
  8009c2:	8b 45 08             	mov    0x8(%ebp),%eax
  8009c5:	8b 4d 10             	mov    0x10(%ebp),%ecx
	const char *s;
	char *d;
	
	s = src;
  8009c8:	8b 75 0c             	mov    0xc(%ebp),%esi
	d = dst;
  8009cb:	89 c7                	mov    %eax,%edi
	if (s < d && s + n > d) {
  8009cd:	39 c6                	cmp    %eax,%esi
  8009cf:	73 35                	jae    800a06 <memmove+0x51>
  8009d1:	8d 14 0e             	lea    (%esi,%ecx,1),%edx
  8009d4:	39 d0                	cmp    %edx,%eax
  8009d6:	73 2e                	jae    800a06 <memmove+0x51>
		s += n;
		d += n;
  8009d8:	01 cf                	add    %ecx,%edi
		if ((int)s%4 == 0 && (int)d%4 == 0 && n%4 == 0)
  8009da:	f6 c2 03             	test   $0x3,%dl
  8009dd:	75 1b                	jne    8009fa <memmove+0x45>
  8009df:	f7 c7 03 00 00 00    	test   $0x3,%edi
  8009e5:	75 13                	jne    8009fa <memmove+0x45>
  8009e7:	f6 c1 03             	test   $0x3,%cl
  8009ea:	75 0e                	jne    8009fa <memmove+0x45>
			asm volatile("std; rep movsl\n"
  8009ec:	83 ef 04             	sub    $0x4,%edi
  8009ef:	8d 72 fc             	lea    -0x4(%edx),%esi
  8009f2:	c1 e9 02             	shr    $0x2,%ecx
  8009f5:	fd                   	std    
  8009f6:	f3 a5                	rep movsl %ds:(%esi),%es:(%edi)
	s = src;
	d = dst;
	if (s < d && s + n > d) {
		s += n;
		d += n;
		if ((int)s%4 == 0 && (int)d%4 == 0 && n%4 == 0)
  8009f8:	eb 09                	jmp    800a03 <memmove+0x4e>
			asm volatile("std; rep movsl\n"
				:: "D" (d-4), "S" (s-4), "c" (n/4) : "cc", "memory");
		else
			asm volatile("std; rep movsb\n"
  8009fa:	83 ef 01             	sub    $0x1,%edi
  8009fd:	8d 72 ff             	lea    -0x1(%edx),%esi
  800a00:	fd                   	std    
  800a01:	f3 a4                	rep movsb %ds:(%esi),%es:(%edi)
				:: "D" (d-1), "S" (s-1), "c" (n) : "cc", "memory");
		// Some versions of GCC rely on DF being clear
		asm volatile("cld" ::: "cc");
  800a03:	fc                   	cld    
	const char *s;
	char *d;
	
	s = src;
	d = dst;
	if (s < d && s + n > d) {
  800a04:	eb 20                	jmp    800a26 <memmove+0x71>
			asm volatile("std; rep movsb\n"
				:: "D" (d-1), "S" (s-1), "c" (n) : "cc", "memory");
		// Some versions of GCC rely on DF being clear
		asm volatile("cld" ::: "cc");
	} else {
		if ((int)s%4 == 0 && (int)d%4 == 0 && n%4 == 0)
  800a06:	f7 c6 03 00 00 00    	test   $0x3,%esi
  800a0c:	75 15                	jne    800a23 <memmove+0x6e>
  800a0e:	f7 c7 03 00 00 00    	test   $0x3,%edi
  800a14:	75 0d                	jne    800a23 <memmove+0x6e>
  800a16:	f6 c1 03             	test   $0x3,%cl
  800a19:	75 08                	jne    800a23 <memmove+0x6e>
			asm volatile("cld; rep movsl\n"
  800a1b:	c1 e9 02             	shr    $0x2,%ecx
  800a1e:	fc                   	cld    
  800a1f:	f3 a5                	rep movsl %ds:(%esi),%es:(%edi)
			asm volatile("std; rep movsb\n"
				:: "D" (d-1), "S" (s-1), "c" (n) : "cc", "memory");
		// Some versions of GCC rely on DF being clear
		asm volatile("cld" ::: "cc");
	} else {
		if ((int)s%4 == 0 && (int)d%4 == 0 && n%4 == 0)
  800a21:	eb 03                	jmp    800a26 <memmove+0x71>
			asm volatile("cld; rep movsl\n"
				:: "D" (d), "S" (s), "c" (n/4) : "cc", "memory");
		else
			asm volatile("cld; rep movsb\n"
  800a23:	fc                   	cld    
  800a24:	f3 a4                	rep movsb %ds:(%esi),%es:(%edi)
				:: "D" (d), "S" (s), "c" (n) : "cc", "memory");
	}
	return dst;
}
  800a26:	8b 34 24             	mov    (%esp),%esi
  800a29:	8b 7c 24 04          	mov    0x4(%esp),%edi
  800a2d:	89 ec                	mov    %ebp,%esp
  800a2f:	5d                   	pop    %ebp
  800a30:	c3                   	ret    

00800a31 <memcpy>:

/* sigh - gcc emits references to this for structure assignments! */
/* it is *not* prototyped in inc/string.h - do not use directly. */
void *
memcpy(void *dst, void *src, size_t n)
{
  800a31:	55                   	push   %ebp
  800a32:	89 e5                	mov    %esp,%ebp
  800a34:	83 ec 0c             	sub    $0xc,%esp
	return memmove(dst, src, n);
  800a37:	8b 45 10             	mov    0x10(%ebp),%eax
  800a3a:	89 44 24 08          	mov    %eax,0x8(%esp)
  800a3e:	8b 45 0c             	mov    0xc(%ebp),%eax
  800a41:	89 44 24 04          	mov    %eax,0x4(%esp)
  800a45:	8b 45 08             	mov    0x8(%ebp),%eax
  800a48:	89 04 24             	mov    %eax,(%esp)
  800a4b:	e8 65 ff ff ff       	call   8009b5 <memmove>
}
  800a50:	c9                   	leave  
  800a51:	c3                   	ret    

00800a52 <memcmp>:

int
memcmp(const void *v1, const void *v2, size_t n)
{
  800a52:	55                   	push   %ebp
  800a53:	89 e5                	mov    %esp,%ebp
  800a55:	57                   	push   %edi
  800a56:	56                   	push   %esi
  800a57:	53                   	push   %ebx
  800a58:	8b 75 08             	mov    0x8(%ebp),%esi
  800a5b:	8b 7d 0c             	mov    0xc(%ebp),%edi
  800a5e:	8b 4d 10             	mov    0x10(%ebp),%ecx
	const uint8_t *s1 = (const uint8_t *) v1;
	const uint8_t *s2 = (const uint8_t *) v2;

	while (n-- > 0) {
  800a61:	85 c9                	test   %ecx,%ecx
  800a63:	74 36                	je     800a9b <memcmp+0x49>
		if (*s1 != *s2)
  800a65:	0f b6 06             	movzbl (%esi),%eax
  800a68:	0f b6 1f             	movzbl (%edi),%ebx
  800a6b:	38 d8                	cmp    %bl,%al
  800a6d:	74 20                	je     800a8f <memcmp+0x3d>
  800a6f:	eb 14                	jmp    800a85 <memcmp+0x33>
  800a71:	0f b6 44 16 01       	movzbl 0x1(%esi,%edx,1),%eax
  800a76:	0f b6 5c 17 01       	movzbl 0x1(%edi,%edx,1),%ebx
  800a7b:	83 c2 01             	add    $0x1,%edx
  800a7e:	83 e9 01             	sub    $0x1,%ecx
  800a81:	38 d8                	cmp    %bl,%al
  800a83:	74 12                	je     800a97 <memcmp+0x45>
			return (int) *s1 - (int) *s2;
  800a85:	0f b6 c0             	movzbl %al,%eax
  800a88:	0f b6 db             	movzbl %bl,%ebx
  800a8b:	29 d8                	sub    %ebx,%eax
  800a8d:	eb 11                	jmp    800aa0 <memcmp+0x4e>
memcmp(const void *v1, const void *v2, size_t n)
{
	const uint8_t *s1 = (const uint8_t *) v1;
	const uint8_t *s2 = (const uint8_t *) v2;

	while (n-- > 0) {
  800a8f:	83 e9 01             	sub    $0x1,%ecx
  800a92:	ba 00 00 00 00       	mov    $0x0,%edx
  800a97:	85 c9                	test   %ecx,%ecx
  800a99:	75 d6                	jne    800a71 <memcmp+0x1f>
  800a9b:	b8 00 00 00 00       	mov    $0x0,%eax
			return (int) *s1 - (int) *s2;
		s1++, s2++;
	}

	return 0;
}
  800aa0:	5b                   	pop    %ebx
  800aa1:	5e                   	pop    %esi
  800aa2:	5f                   	pop    %edi
  800aa3:	5d                   	pop    %ebp
  800aa4:	c3                   	ret    

00800aa5 <memfind>:

void *
memfind(const void *s, int c, size_t n)
{
  800aa5:	55                   	push   %ebp
  800aa6:	89 e5                	mov    %esp,%ebp
  800aa8:	8b 45 08             	mov    0x8(%ebp),%eax
	const void *ends = (const char *) s + n;
  800aab:	89 c2                	mov    %eax,%edx
  800aad:	03 55 10             	add    0x10(%ebp),%edx
	for (; s < ends; s++)
  800ab0:	39 d0                	cmp    %edx,%eax
  800ab2:	73 15                	jae    800ac9 <memfind+0x24>
		if (*(const unsigned char *) s == (unsigned char) c)
  800ab4:	0f b6 4d 0c          	movzbl 0xc(%ebp),%ecx
  800ab8:	38 08                	cmp    %cl,(%eax)
  800aba:	75 06                	jne    800ac2 <memfind+0x1d>
  800abc:	eb 0b                	jmp    800ac9 <memfind+0x24>
  800abe:	38 08                	cmp    %cl,(%eax)
  800ac0:	74 07                	je     800ac9 <memfind+0x24>

void *
memfind(const void *s, int c, size_t n)
{
	const void *ends = (const char *) s + n;
	for (; s < ends; s++)
  800ac2:	83 c0 01             	add    $0x1,%eax
  800ac5:	39 c2                	cmp    %eax,%edx
  800ac7:	77 f5                	ja     800abe <memfind+0x19>
		if (*(const unsigned char *) s == (unsigned char) c)
			break;
	return (void *) s;
}
  800ac9:	5d                   	pop    %ebp
  800aca:	c3                   	ret    

00800acb <strtol>:

long
strtol(const char *s, char **endptr, int base)
{
  800acb:	55                   	push   %ebp
  800acc:	89 e5                	mov    %esp,%ebp
  800ace:	57                   	push   %edi
  800acf:	56                   	push   %esi
  800ad0:	53                   	push   %ebx
  800ad1:	83 ec 04             	sub    $0x4,%esp
  800ad4:	8b 55 08             	mov    0x8(%ebp),%edx
  800ad7:	8b 5d 10             	mov    0x10(%ebp),%ebx
	int neg = 0;
	long val = 0;

	// gobble initial whitespace
	while (*s == ' ' || *s == '\t')
  800ada:	0f b6 02             	movzbl (%edx),%eax
  800add:	3c 20                	cmp    $0x20,%al
  800adf:	74 04                	je     800ae5 <strtol+0x1a>
  800ae1:	3c 09                	cmp    $0x9,%al
  800ae3:	75 0e                	jne    800af3 <strtol+0x28>
		s++;
  800ae5:	83 c2 01             	add    $0x1,%edx
{
	int neg = 0;
	long val = 0;

	// gobble initial whitespace
	while (*s == ' ' || *s == '\t')
  800ae8:	0f b6 02             	movzbl (%edx),%eax
  800aeb:	3c 20                	cmp    $0x20,%al
  800aed:	74 f6                	je     800ae5 <strtol+0x1a>
  800aef:	3c 09                	cmp    $0x9,%al
  800af1:	74 f2                	je     800ae5 <strtol+0x1a>
		s++;

	// plus/minus sign
	if (*s == '+')
  800af3:	3c 2b                	cmp    $0x2b,%al
  800af5:	75 0c                	jne    800b03 <strtol+0x38>
		s++;
  800af7:	83 c2 01             	add    $0x1,%edx
  800afa:	c7 45 f0 00 00 00 00 	movl   $0x0,-0x10(%ebp)
  800b01:	eb 15                	jmp    800b18 <strtol+0x4d>
	else if (*s == '-')
  800b03:	c7 45 f0 00 00 00 00 	movl   $0x0,-0x10(%ebp)
  800b0a:	3c 2d                	cmp    $0x2d,%al
  800b0c:	75 0a                	jne    800b18 <strtol+0x4d>
		s++, neg = 1;
  800b0e:	83 c2 01             	add    $0x1,%edx
  800b11:	c7 45 f0 01 00 00 00 	movl   $0x1,-0x10(%ebp)

	// hex or octal base prefix
	if ((base == 0 || base == 16) && (s[0] == '0' && s[1] == 'x'))
  800b18:	85 db                	test   %ebx,%ebx
  800b1a:	0f 94 c0             	sete   %al
  800b1d:	74 05                	je     800b24 <strtol+0x59>
  800b1f:	83 fb 10             	cmp    $0x10,%ebx
  800b22:	75 18                	jne    800b3c <strtol+0x71>
  800b24:	80 3a 30             	cmpb   $0x30,(%edx)
  800b27:	75 13                	jne    800b3c <strtol+0x71>
  800b29:	80 7a 01 78          	cmpb   $0x78,0x1(%edx)
  800b2d:	8d 76 00             	lea    0x0(%esi),%esi
  800b30:	75 0a                	jne    800b3c <strtol+0x71>
		s += 2, base = 16;
  800b32:	83 c2 02             	add    $0x2,%edx
  800b35:	bb 10 00 00 00       	mov    $0x10,%ebx
		s++;
	else if (*s == '-')
		s++, neg = 1;

	// hex or octal base prefix
	if ((base == 0 || base == 16) && (s[0] == '0' && s[1] == 'x'))
  800b3a:	eb 15                	jmp    800b51 <strtol+0x86>
		s += 2, base = 16;
	else if (base == 0 && s[0] == '0')
  800b3c:	84 c0                	test   %al,%al
  800b3e:	66 90                	xchg   %ax,%ax
  800b40:	74 0f                	je     800b51 <strtol+0x86>
  800b42:	bb 0a 00 00 00       	mov    $0xa,%ebx
  800b47:	80 3a 30             	cmpb   $0x30,(%edx)
  800b4a:	75 05                	jne    800b51 <strtol+0x86>
		s++, base = 8;
  800b4c:	83 c2 01             	add    $0x1,%edx
  800b4f:	b3 08                	mov    $0x8,%bl
		s++, neg = 1;

	// hex or octal base prefix
	if ((base == 0 || base == 16) && (s[0] == '0' && s[1] == 'x'))
		s += 2, base = 16;
	else if (base == 0 && s[0] == '0')
  800b51:	b8 00 00 00 00       	mov    $0x0,%eax
  800b56:	89 de                	mov    %ebx,%esi

	// digits
	while (1) {
		int dig;

		if (*s >= '0' && *s <= '9')
  800b58:	0f b6 0a             	movzbl (%edx),%ecx
  800b5b:	89 cf                	mov    %ecx,%edi
  800b5d:	8d 59 d0             	lea    -0x30(%ecx),%ebx
  800b60:	80 fb 09             	cmp    $0x9,%bl
  800b63:	77 08                	ja     800b6d <strtol+0xa2>
			dig = *s - '0';
  800b65:	0f be c9             	movsbl %cl,%ecx
  800b68:	83 e9 30             	sub    $0x30,%ecx
  800b6b:	eb 1e                	jmp    800b8b <strtol+0xc0>
		else if (*s >= 'a' && *s <= 'z')
  800b6d:	8d 5f 9f             	lea    -0x61(%edi),%ebx
  800b70:	80 fb 19             	cmp    $0x19,%bl
  800b73:	77 08                	ja     800b7d <strtol+0xb2>
			dig = *s - 'a' + 10;
  800b75:	0f be c9             	movsbl %cl,%ecx
  800b78:	83 e9 57             	sub    $0x57,%ecx
  800b7b:	eb 0e                	jmp    800b8b <strtol+0xc0>
		else if (*s >= 'A' && *s <= 'Z')
  800b7d:	8d 5f bf             	lea    -0x41(%edi),%ebx
  800b80:	80 fb 19             	cmp    $0x19,%bl
  800b83:	77 15                	ja     800b9a <strtol+0xcf>
			dig = *s - 'A' + 10;
  800b85:	0f be c9             	movsbl %cl,%ecx
  800b88:	83 e9 37             	sub    $0x37,%ecx
		else
			break;
		if (dig >= base)
  800b8b:	39 f1                	cmp    %esi,%ecx
  800b8d:	7d 0b                	jge    800b9a <strtol+0xcf>
			break;
		s++, val = (val * base) + dig;
  800b8f:	83 c2 01             	add    $0x1,%edx
  800b92:	0f af c6             	imul   %esi,%eax
  800b95:	8d 04 01             	lea    (%ecx,%eax,1),%eax
		// we don't properly detect overflow!
	}
  800b98:	eb be                	jmp    800b58 <strtol+0x8d>
  800b9a:	89 c1                	mov    %eax,%ecx

	if (endptr)
  800b9c:	83 7d 0c 00          	cmpl   $0x0,0xc(%ebp)
  800ba0:	74 05                	je     800ba7 <strtol+0xdc>
		*endptr = (char *) s;
  800ba2:	8b 5d 0c             	mov    0xc(%ebp),%ebx
  800ba5:	89 13                	mov    %edx,(%ebx)
	return (neg ? -val : val);
  800ba7:	89 ca                	mov    %ecx,%edx
  800ba9:	f7 da                	neg    %edx
  800bab:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
  800baf:	0f 45 c2             	cmovne %edx,%eax
}
  800bb2:	83 c4 04             	add    $0x4,%esp
  800bb5:	5b                   	pop    %ebx
  800bb6:	5e                   	pop    %esi
  800bb7:	5f                   	pop    %edi
  800bb8:	5d                   	pop    %ebp
  800bb9:	c3                   	ret    
	...

00800bbc <sys_cgetc>:
	syscall(SYS_cputs, 0, (uint32_t)s, len, 0, 0, 0);
}

int
sys_cgetc(void)
{
  800bbc:	55                   	push   %ebp
  800bbd:	89 e5                	mov    %esp,%ebp
  800bbf:	83 ec 0c             	sub    $0xc,%esp
  800bc2:	89 1c 24             	mov    %ebx,(%esp)
  800bc5:	89 74 24 04          	mov    %esi,0x4(%esp)
  800bc9:	89 7c 24 08          	mov    %edi,0x8(%esp)
	// 
	// The last clause tells the assembler that this can
	// potentially change the condition codes and arbitrary
	// memory locations.

	asm volatile("int %1\n"
  800bcd:	ba 00 00 00 00       	mov    $0x0,%edx
  800bd2:	b8 01 00 00 00       	mov    $0x1,%eax
  800bd7:	89 d1                	mov    %edx,%ecx
  800bd9:	89 d3                	mov    %edx,%ebx
  800bdb:	89 d7                	mov    %edx,%edi
  800bdd:	89 d6                	mov    %edx,%esi
  800bdf:	cd 30                	int    $0x30

int
sys_cgetc(void)
{
	return syscall(SYS_cgetc, 0, 0, 0, 0, 0, 0);
}
  800be1:	8b 1c 24             	mov    (%esp),%ebx
  800be4:	8b 74 24 04          	mov    0x4(%esp),%esi
  800be8:	8b 7c 24 08          	mov    0x8(%esp),%edi
  800bec:	89 ec                	mov    %ebp,%esp
  800bee:	5d                   	pop    %ebp
  800bef:	c3                   	ret    

00800bf0 <sys_cputs>:
	return ret;
}

void
sys_cputs(const char *s, size_t len)
{
  800bf0:	55                   	push   %ebp
  800bf1:	89 e5                	mov    %esp,%ebp
  800bf3:	83 ec 0c             	sub    $0xc,%esp
  800bf6:	89 1c 24             	mov    %ebx,(%esp)
  800bf9:	89 74 24 04          	mov    %esi,0x4(%esp)
  800bfd:	89 7c 24 08          	mov    %edi,0x8(%esp)
	// 
	// The last clause tells the assembler that this can
	// potentially change the condition codes and arbitrary
	// memory locations.

	asm volatile("int %1\n"
  800c01:	b8 00 00 00 00       	mov    $0x0,%eax
  800c06:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800c09:	8b 55 08             	mov    0x8(%ebp),%edx
  800c0c:	89 c3                	mov    %eax,%ebx
  800c0e:	89 c7                	mov    %eax,%edi
  800c10:	89 c6                	mov    %eax,%esi
  800c12:	cd 30                	int    $0x30

void
sys_cputs(const char *s, size_t len)
{
	syscall(SYS_cputs, 0, (uint32_t)s, len, 0, 0, 0);
}
  800c14:	8b 1c 24             	mov    (%esp),%ebx
  800c17:	8b 74 24 04          	mov    0x4(%esp),%esi
  800c1b:	8b 7c 24 08          	mov    0x8(%esp),%edi
  800c1f:	89 ec                	mov    %ebp,%esp
  800c21:	5d                   	pop    %ebp
  800c22:	c3                   	ret    

00800c23 <sys_ns_recv>:
  return syscall(SYS_ns_send, 0, (uint32_t)pkt, len, 0, 0, 0);
}

int
sys_ns_recv(void *pkt, uint32_t len)
{
  800c23:	55                   	push   %ebp
  800c24:	89 e5                	mov    %esp,%ebp
  800c26:	83 ec 0c             	sub    $0xc,%esp
  800c29:	89 1c 24             	mov    %ebx,(%esp)
  800c2c:	89 74 24 04          	mov    %esi,0x4(%esp)
  800c30:	89 7c 24 08          	mov    %edi,0x8(%esp)
	// 
	// The last clause tells the assembler that this can
	// potentially change the condition codes and arbitrary
	// memory locations.

	asm volatile("int %1\n"
  800c34:	bb 00 00 00 00       	mov    $0x0,%ebx
  800c39:	b8 10 00 00 00       	mov    $0x10,%eax
  800c3e:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800c41:	8b 55 08             	mov    0x8(%ebp),%edx
  800c44:	89 df                	mov    %ebx,%edi
  800c46:	89 de                	mov    %ebx,%esi
  800c48:	cd 30                	int    $0x30

int
sys_ns_recv(void *pkt, uint32_t len)
{
  return syscall(SYS_ns_recv, 0, (uint32_t)pkt, len, 0, 0, 0);
}
  800c4a:	8b 1c 24             	mov    (%esp),%ebx
  800c4d:	8b 74 24 04          	mov    0x4(%esp),%esi
  800c51:	8b 7c 24 08          	mov    0x8(%esp),%edi
  800c55:	89 ec                	mov    %ebp,%esp
  800c57:	5d                   	pop    %ebp
  800c58:	c3                   	ret    

00800c59 <sys_ns_send>:
	return (unsigned int) syscall(SYS_time_msec, 0, 0, 0, 0, 0, 0);
}

int
sys_ns_send(void *pkt, uint32_t len)
{
  800c59:	55                   	push   %ebp
  800c5a:	89 e5                	mov    %esp,%ebp
  800c5c:	83 ec 0c             	sub    $0xc,%esp
  800c5f:	89 1c 24             	mov    %ebx,(%esp)
  800c62:	89 74 24 04          	mov    %esi,0x4(%esp)
  800c66:	89 7c 24 08          	mov    %edi,0x8(%esp)
	// 
	// The last clause tells the assembler that this can
	// potentially change the condition codes and arbitrary
	// memory locations.

	asm volatile("int %1\n"
  800c6a:	bb 00 00 00 00       	mov    $0x0,%ebx
  800c6f:	b8 0f 00 00 00       	mov    $0xf,%eax
  800c74:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800c77:	8b 55 08             	mov    0x8(%ebp),%edx
  800c7a:	89 df                	mov    %ebx,%edi
  800c7c:	89 de                	mov    %ebx,%esi
  800c7e:	cd 30                	int    $0x30

int
sys_ns_send(void *pkt, uint32_t len)
{
  return syscall(SYS_ns_send, 0, (uint32_t)pkt, len, 0, 0, 0);
}
  800c80:	8b 1c 24             	mov    (%esp),%ebx
  800c83:	8b 74 24 04          	mov    0x4(%esp),%esi
  800c87:	8b 7c 24 08          	mov    0x8(%esp),%edi
  800c8b:	89 ec                	mov    %ebp,%esp
  800c8d:	5d                   	pop    %ebp
  800c8e:	c3                   	ret    

00800c8f <sys_time_msec>:
	return syscall(SYS_ipc_recv, 1, (uint32_t)dstva, 0, 0, 0, 0);
}

unsigned int
sys_time_msec(void)
{
  800c8f:	55                   	push   %ebp
  800c90:	89 e5                	mov    %esp,%ebp
  800c92:	83 ec 0c             	sub    $0xc,%esp
  800c95:	89 1c 24             	mov    %ebx,(%esp)
  800c98:	89 74 24 04          	mov    %esi,0x4(%esp)
  800c9c:	89 7c 24 08          	mov    %edi,0x8(%esp)
	// 
	// The last clause tells the assembler that this can
	// potentially change the condition codes and arbitrary
	// memory locations.

	asm volatile("int %1\n"
  800ca0:	ba 00 00 00 00       	mov    $0x0,%edx
  800ca5:	b8 0e 00 00 00       	mov    $0xe,%eax
  800caa:	89 d1                	mov    %edx,%ecx
  800cac:	89 d3                	mov    %edx,%ebx
  800cae:	89 d7                	mov    %edx,%edi
  800cb0:	89 d6                	mov    %edx,%esi
  800cb2:	cd 30                	int    $0x30

unsigned int
sys_time_msec(void)
{
	return (unsigned int) syscall(SYS_time_msec, 0, 0, 0, 0, 0, 0);
}
  800cb4:	8b 1c 24             	mov    (%esp),%ebx
  800cb7:	8b 74 24 04          	mov    0x4(%esp),%esi
  800cbb:	8b 7c 24 08          	mov    0x8(%esp),%edi
  800cbf:	89 ec                	mov    %ebp,%esp
  800cc1:	5d                   	pop    %ebp
  800cc2:	c3                   	ret    

00800cc3 <sys_ipc_recv>:
	return syscall(SYS_ipc_try_send, 1, envid, value, (uint32_t) srcva, perm, 0);
}

int
sys_ipc_recv(void *dstva)
{
  800cc3:	55                   	push   %ebp
  800cc4:	89 e5                	mov    %esp,%ebp
  800cc6:	83 ec 38             	sub    $0x38,%esp
  800cc9:	89 5d f4             	mov    %ebx,-0xc(%ebp)
  800ccc:	89 75 f8             	mov    %esi,-0x8(%ebp)
  800ccf:	89 7d fc             	mov    %edi,-0x4(%ebp)
	// 
	// The last clause tells the assembler that this can
	// potentially change the condition codes and arbitrary
	// memory locations.

	asm volatile("int %1\n"
  800cd2:	b9 00 00 00 00       	mov    $0x0,%ecx
  800cd7:	b8 0d 00 00 00       	mov    $0xd,%eax
  800cdc:	8b 55 08             	mov    0x8(%ebp),%edx
  800cdf:	89 cb                	mov    %ecx,%ebx
  800ce1:	89 cf                	mov    %ecx,%edi
  800ce3:	89 ce                	mov    %ecx,%esi
  800ce5:	cd 30                	int    $0x30
		  "b" (a3),
		  "D" (a4),
		  "S" (a5)
		: "cc", "memory");
	
	if(check && ret > 0)
  800ce7:	85 c0                	test   %eax,%eax
  800ce9:	7e 28                	jle    800d13 <sys_ipc_recv+0x50>
		panic("syscall %d returned %d (> 0)", num, ret);
  800ceb:	89 44 24 10          	mov    %eax,0x10(%esp)
  800cef:	c7 44 24 0c 0d 00 00 	movl   $0xd,0xc(%esp)
  800cf6:	00 
  800cf7:	c7 44 24 08 4b 2b 80 	movl   $0x802b4b,0x8(%esp)
  800cfe:	00 
  800cff:	c7 44 24 04 23 00 00 	movl   $0x23,0x4(%esp)
  800d06:	00 
  800d07:	c7 04 24 68 2b 80 00 	movl   $0x802b68,(%esp)
  800d0e:	e8 01 17 00 00       	call   802414 <_panic>

int
sys_ipc_recv(void *dstva)
{
	return syscall(SYS_ipc_recv, 1, (uint32_t)dstva, 0, 0, 0, 0);
}
  800d13:	8b 5d f4             	mov    -0xc(%ebp),%ebx
  800d16:	8b 75 f8             	mov    -0x8(%ebp),%esi
  800d19:	8b 7d fc             	mov    -0x4(%ebp),%edi
  800d1c:	89 ec                	mov    %ebp,%esp
  800d1e:	5d                   	pop    %ebp
  800d1f:	c3                   	ret    

00800d20 <sys_ipc_try_send>:
	return syscall(SYS_env_set_pgfault_upcall, 1, envid, (uint32_t) upcall, 0, 0, 0);
}

int
sys_ipc_try_send(envid_t envid, uint32_t value, void *srcva, int perm)
{
  800d20:	55                   	push   %ebp
  800d21:	89 e5                	mov    %esp,%ebp
  800d23:	83 ec 38             	sub    $0x38,%esp
  800d26:	89 5d f4             	mov    %ebx,-0xc(%ebp)
  800d29:	89 75 f8             	mov    %esi,-0x8(%ebp)
  800d2c:	89 7d fc             	mov    %edi,-0x4(%ebp)
	// 
	// The last clause tells the assembler that this can
	// potentially change the condition codes and arbitrary
	// memory locations.

	asm volatile("int %1\n"
  800d2f:	be 00 00 00 00       	mov    $0x0,%esi
  800d34:	b8 0c 00 00 00       	mov    $0xc,%eax
  800d39:	8b 7d 14             	mov    0x14(%ebp),%edi
  800d3c:	8b 5d 10             	mov    0x10(%ebp),%ebx
  800d3f:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800d42:	8b 55 08             	mov    0x8(%ebp),%edx
  800d45:	cd 30                	int    $0x30
		  "b" (a3),
		  "D" (a4),
		  "S" (a5)
		: "cc", "memory");
	
	if(check && ret > 0)
  800d47:	85 c0                	test   %eax,%eax
  800d49:	7e 28                	jle    800d73 <sys_ipc_try_send+0x53>
		panic("syscall %d returned %d (> 0)", num, ret);
  800d4b:	89 44 24 10          	mov    %eax,0x10(%esp)
  800d4f:	c7 44 24 0c 0c 00 00 	movl   $0xc,0xc(%esp)
  800d56:	00 
  800d57:	c7 44 24 08 4b 2b 80 	movl   $0x802b4b,0x8(%esp)
  800d5e:	00 
  800d5f:	c7 44 24 04 23 00 00 	movl   $0x23,0x4(%esp)
  800d66:	00 
  800d67:	c7 04 24 68 2b 80 00 	movl   $0x802b68,(%esp)
  800d6e:	e8 a1 16 00 00       	call   802414 <_panic>

int
sys_ipc_try_send(envid_t envid, uint32_t value, void *srcva, int perm)
{
	return syscall(SYS_ipc_try_send, 1, envid, value, (uint32_t) srcva, perm, 0);
}
  800d73:	8b 5d f4             	mov    -0xc(%ebp),%ebx
  800d76:	8b 75 f8             	mov    -0x8(%ebp),%esi
  800d79:	8b 7d fc             	mov    -0x4(%ebp),%edi
  800d7c:	89 ec                	mov    %ebp,%esp
  800d7e:	5d                   	pop    %ebp
  800d7f:	c3                   	ret    

00800d80 <sys_env_set_pgfault_upcall>:
	return syscall(SYS_env_set_trapframe, 1, envid, (uint32_t) tf, 0, 0, 0);
}

int
sys_env_set_pgfault_upcall(envid_t envid, void *upcall)
{
  800d80:	55                   	push   %ebp
  800d81:	89 e5                	mov    %esp,%ebp
  800d83:	83 ec 38             	sub    $0x38,%esp
  800d86:	89 5d f4             	mov    %ebx,-0xc(%ebp)
  800d89:	89 75 f8             	mov    %esi,-0x8(%ebp)
  800d8c:	89 7d fc             	mov    %edi,-0x4(%ebp)
	// 
	// The last clause tells the assembler that this can
	// potentially change the condition codes and arbitrary
	// memory locations.

	asm volatile("int %1\n"
  800d8f:	bb 00 00 00 00       	mov    $0x0,%ebx
  800d94:	b8 0a 00 00 00       	mov    $0xa,%eax
  800d99:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800d9c:	8b 55 08             	mov    0x8(%ebp),%edx
  800d9f:	89 df                	mov    %ebx,%edi
  800da1:	89 de                	mov    %ebx,%esi
  800da3:	cd 30                	int    $0x30
		  "b" (a3),
		  "D" (a4),
		  "S" (a5)
		: "cc", "memory");
	
	if(check && ret > 0)
  800da5:	85 c0                	test   %eax,%eax
  800da7:	7e 28                	jle    800dd1 <sys_env_set_pgfault_upcall+0x51>
		panic("syscall %d returned %d (> 0)", num, ret);
  800da9:	89 44 24 10          	mov    %eax,0x10(%esp)
  800dad:	c7 44 24 0c 0a 00 00 	movl   $0xa,0xc(%esp)
  800db4:	00 
  800db5:	c7 44 24 08 4b 2b 80 	movl   $0x802b4b,0x8(%esp)
  800dbc:	00 
  800dbd:	c7 44 24 04 23 00 00 	movl   $0x23,0x4(%esp)
  800dc4:	00 
  800dc5:	c7 04 24 68 2b 80 00 	movl   $0x802b68,(%esp)
  800dcc:	e8 43 16 00 00       	call   802414 <_panic>

int
sys_env_set_pgfault_upcall(envid_t envid, void *upcall)
{
	return syscall(SYS_env_set_pgfault_upcall, 1, envid, (uint32_t) upcall, 0, 0, 0);
}
  800dd1:	8b 5d f4             	mov    -0xc(%ebp),%ebx
  800dd4:	8b 75 f8             	mov    -0x8(%ebp),%esi
  800dd7:	8b 7d fc             	mov    -0x4(%ebp),%edi
  800dda:	89 ec                	mov    %ebp,%esp
  800ddc:	5d                   	pop    %ebp
  800ddd:	c3                   	ret    

00800dde <sys_env_set_trapframe>:
	return syscall(SYS_env_set_status, 1, envid, status, 0, 0, 0);
}

int
sys_env_set_trapframe(envid_t envid, struct Trapframe *tf)
{
  800dde:	55                   	push   %ebp
  800ddf:	89 e5                	mov    %esp,%ebp
  800de1:	83 ec 38             	sub    $0x38,%esp
  800de4:	89 5d f4             	mov    %ebx,-0xc(%ebp)
  800de7:	89 75 f8             	mov    %esi,-0x8(%ebp)
  800dea:	89 7d fc             	mov    %edi,-0x4(%ebp)
	// 
	// The last clause tells the assembler that this can
	// potentially change the condition codes and arbitrary
	// memory locations.

	asm volatile("int %1\n"
  800ded:	bb 00 00 00 00       	mov    $0x0,%ebx
  800df2:	b8 09 00 00 00       	mov    $0x9,%eax
  800df7:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800dfa:	8b 55 08             	mov    0x8(%ebp),%edx
  800dfd:	89 df                	mov    %ebx,%edi
  800dff:	89 de                	mov    %ebx,%esi
  800e01:	cd 30                	int    $0x30
		  "b" (a3),
		  "D" (a4),
		  "S" (a5)
		: "cc", "memory");
	
	if(check && ret > 0)
  800e03:	85 c0                	test   %eax,%eax
  800e05:	7e 28                	jle    800e2f <sys_env_set_trapframe+0x51>
		panic("syscall %d returned %d (> 0)", num, ret);
  800e07:	89 44 24 10          	mov    %eax,0x10(%esp)
  800e0b:	c7 44 24 0c 09 00 00 	movl   $0x9,0xc(%esp)
  800e12:	00 
  800e13:	c7 44 24 08 4b 2b 80 	movl   $0x802b4b,0x8(%esp)
  800e1a:	00 
  800e1b:	c7 44 24 04 23 00 00 	movl   $0x23,0x4(%esp)
  800e22:	00 
  800e23:	c7 04 24 68 2b 80 00 	movl   $0x802b68,(%esp)
  800e2a:	e8 e5 15 00 00       	call   802414 <_panic>

int
sys_env_set_trapframe(envid_t envid, struct Trapframe *tf)
{
	return syscall(SYS_env_set_trapframe, 1, envid, (uint32_t) tf, 0, 0, 0);
}
  800e2f:	8b 5d f4             	mov    -0xc(%ebp),%ebx
  800e32:	8b 75 f8             	mov    -0x8(%ebp),%esi
  800e35:	8b 7d fc             	mov    -0x4(%ebp),%edi
  800e38:	89 ec                	mov    %ebp,%esp
  800e3a:	5d                   	pop    %ebp
  800e3b:	c3                   	ret    

00800e3c <sys_env_set_status>:

// sys_exofork is inlined in lib.h

int
sys_env_set_status(envid_t envid, int status)
{
  800e3c:	55                   	push   %ebp
  800e3d:	89 e5                	mov    %esp,%ebp
  800e3f:	83 ec 38             	sub    $0x38,%esp
  800e42:	89 5d f4             	mov    %ebx,-0xc(%ebp)
  800e45:	89 75 f8             	mov    %esi,-0x8(%ebp)
  800e48:	89 7d fc             	mov    %edi,-0x4(%ebp)
	// 
	// The last clause tells the assembler that this can
	// potentially change the condition codes and arbitrary
	// memory locations.

	asm volatile("int %1\n"
  800e4b:	bb 00 00 00 00       	mov    $0x0,%ebx
  800e50:	b8 08 00 00 00       	mov    $0x8,%eax
  800e55:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800e58:	8b 55 08             	mov    0x8(%ebp),%edx
  800e5b:	89 df                	mov    %ebx,%edi
  800e5d:	89 de                	mov    %ebx,%esi
  800e5f:	cd 30                	int    $0x30
		  "b" (a3),
		  "D" (a4),
		  "S" (a5)
		: "cc", "memory");
	
	if(check && ret > 0)
  800e61:	85 c0                	test   %eax,%eax
  800e63:	7e 28                	jle    800e8d <sys_env_set_status+0x51>
		panic("syscall %d returned %d (> 0)", num, ret);
  800e65:	89 44 24 10          	mov    %eax,0x10(%esp)
  800e69:	c7 44 24 0c 08 00 00 	movl   $0x8,0xc(%esp)
  800e70:	00 
  800e71:	c7 44 24 08 4b 2b 80 	movl   $0x802b4b,0x8(%esp)
  800e78:	00 
  800e79:	c7 44 24 04 23 00 00 	movl   $0x23,0x4(%esp)
  800e80:	00 
  800e81:	c7 04 24 68 2b 80 00 	movl   $0x802b68,(%esp)
  800e88:	e8 87 15 00 00       	call   802414 <_panic>

int
sys_env_set_status(envid_t envid, int status)
{
	return syscall(SYS_env_set_status, 1, envid, status, 0, 0, 0);
}
  800e8d:	8b 5d f4             	mov    -0xc(%ebp),%ebx
  800e90:	8b 75 f8             	mov    -0x8(%ebp),%esi
  800e93:	8b 7d fc             	mov    -0x4(%ebp),%edi
  800e96:	89 ec                	mov    %ebp,%esp
  800e98:	5d                   	pop    %ebp
  800e99:	c3                   	ret    

00800e9a <sys_page_unmap>:
	return syscall(SYS_page_map, 1, srcenv, (uint32_t) srcva, dstenv, (uint32_t) dstva, perm);
}

int
sys_page_unmap(envid_t envid, void *va)
{
  800e9a:	55                   	push   %ebp
  800e9b:	89 e5                	mov    %esp,%ebp
  800e9d:	83 ec 38             	sub    $0x38,%esp
  800ea0:	89 5d f4             	mov    %ebx,-0xc(%ebp)
  800ea3:	89 75 f8             	mov    %esi,-0x8(%ebp)
  800ea6:	89 7d fc             	mov    %edi,-0x4(%ebp)
	// 
	// The last clause tells the assembler that this can
	// potentially change the condition codes and arbitrary
	// memory locations.

	asm volatile("int %1\n"
  800ea9:	bb 00 00 00 00       	mov    $0x0,%ebx
  800eae:	b8 06 00 00 00       	mov    $0x6,%eax
  800eb3:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800eb6:	8b 55 08             	mov    0x8(%ebp),%edx
  800eb9:	89 df                	mov    %ebx,%edi
  800ebb:	89 de                	mov    %ebx,%esi
  800ebd:	cd 30                	int    $0x30
		  "b" (a3),
		  "D" (a4),
		  "S" (a5)
		: "cc", "memory");
	
	if(check && ret > 0)
  800ebf:	85 c0                	test   %eax,%eax
  800ec1:	7e 28                	jle    800eeb <sys_page_unmap+0x51>
		panic("syscall %d returned %d (> 0)", num, ret);
  800ec3:	89 44 24 10          	mov    %eax,0x10(%esp)
  800ec7:	c7 44 24 0c 06 00 00 	movl   $0x6,0xc(%esp)
  800ece:	00 
  800ecf:	c7 44 24 08 4b 2b 80 	movl   $0x802b4b,0x8(%esp)
  800ed6:	00 
  800ed7:	c7 44 24 04 23 00 00 	movl   $0x23,0x4(%esp)
  800ede:	00 
  800edf:	c7 04 24 68 2b 80 00 	movl   $0x802b68,(%esp)
  800ee6:	e8 29 15 00 00       	call   802414 <_panic>

int
sys_page_unmap(envid_t envid, void *va)
{
	return syscall(SYS_page_unmap, 1, envid, (uint32_t) va, 0, 0, 0);
}
  800eeb:	8b 5d f4             	mov    -0xc(%ebp),%ebx
  800eee:	8b 75 f8             	mov    -0x8(%ebp),%esi
  800ef1:	8b 7d fc             	mov    -0x4(%ebp),%edi
  800ef4:	89 ec                	mov    %ebp,%esp
  800ef6:	5d                   	pop    %ebp
  800ef7:	c3                   	ret    

00800ef8 <sys_page_map>:
	return syscall(SYS_page_alloc, 1, envid, (uint32_t) va, perm, 0, 0);
}

int
sys_page_map(envid_t srcenv, void *srcva, envid_t dstenv, void *dstva, int perm)
{
  800ef8:	55                   	push   %ebp
  800ef9:	89 e5                	mov    %esp,%ebp
  800efb:	83 ec 38             	sub    $0x38,%esp
  800efe:	89 5d f4             	mov    %ebx,-0xc(%ebp)
  800f01:	89 75 f8             	mov    %esi,-0x8(%ebp)
  800f04:	89 7d fc             	mov    %edi,-0x4(%ebp)
	// 
	// The last clause tells the assembler that this can
	// potentially change the condition codes and arbitrary
	// memory locations.

	asm volatile("int %1\n"
  800f07:	b8 05 00 00 00       	mov    $0x5,%eax
  800f0c:	8b 75 18             	mov    0x18(%ebp),%esi
  800f0f:	8b 7d 14             	mov    0x14(%ebp),%edi
  800f12:	8b 5d 10             	mov    0x10(%ebp),%ebx
  800f15:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800f18:	8b 55 08             	mov    0x8(%ebp),%edx
  800f1b:	cd 30                	int    $0x30
		  "b" (a3),
		  "D" (a4),
		  "S" (a5)
		: "cc", "memory");
	
	if(check && ret > 0)
  800f1d:	85 c0                	test   %eax,%eax
  800f1f:	7e 28                	jle    800f49 <sys_page_map+0x51>
		panic("syscall %d returned %d (> 0)", num, ret);
  800f21:	89 44 24 10          	mov    %eax,0x10(%esp)
  800f25:	c7 44 24 0c 05 00 00 	movl   $0x5,0xc(%esp)
  800f2c:	00 
  800f2d:	c7 44 24 08 4b 2b 80 	movl   $0x802b4b,0x8(%esp)
  800f34:	00 
  800f35:	c7 44 24 04 23 00 00 	movl   $0x23,0x4(%esp)
  800f3c:	00 
  800f3d:	c7 04 24 68 2b 80 00 	movl   $0x802b68,(%esp)
  800f44:	e8 cb 14 00 00       	call   802414 <_panic>

int
sys_page_map(envid_t srcenv, void *srcva, envid_t dstenv, void *dstva, int perm)
{
	return syscall(SYS_page_map, 1, srcenv, (uint32_t) srcva, dstenv, (uint32_t) dstva, perm);
}
  800f49:	8b 5d f4             	mov    -0xc(%ebp),%ebx
  800f4c:	8b 75 f8             	mov    -0x8(%ebp),%esi
  800f4f:	8b 7d fc             	mov    -0x4(%ebp),%edi
  800f52:	89 ec                	mov    %ebp,%esp
  800f54:	5d                   	pop    %ebp
  800f55:	c3                   	ret    

00800f56 <sys_page_alloc>:
	syscall(SYS_yield, 0, 0, 0, 0, 0, 0);
}

int
sys_page_alloc(envid_t envid, void *va, int perm)
{
  800f56:	55                   	push   %ebp
  800f57:	89 e5                	mov    %esp,%ebp
  800f59:	83 ec 38             	sub    $0x38,%esp
  800f5c:	89 5d f4             	mov    %ebx,-0xc(%ebp)
  800f5f:	89 75 f8             	mov    %esi,-0x8(%ebp)
  800f62:	89 7d fc             	mov    %edi,-0x4(%ebp)
	// 
	// The last clause tells the assembler that this can
	// potentially change the condition codes and arbitrary
	// memory locations.

	asm volatile("int %1\n"
  800f65:	be 00 00 00 00       	mov    $0x0,%esi
  800f6a:	b8 04 00 00 00       	mov    $0x4,%eax
  800f6f:	8b 5d 10             	mov    0x10(%ebp),%ebx
  800f72:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800f75:	8b 55 08             	mov    0x8(%ebp),%edx
  800f78:	89 f7                	mov    %esi,%edi
  800f7a:	cd 30                	int    $0x30
		  "b" (a3),
		  "D" (a4),
		  "S" (a5)
		: "cc", "memory");
	
	if(check && ret > 0)
  800f7c:	85 c0                	test   %eax,%eax
  800f7e:	7e 28                	jle    800fa8 <sys_page_alloc+0x52>
		panic("syscall %d returned %d (> 0)", num, ret);
  800f80:	89 44 24 10          	mov    %eax,0x10(%esp)
  800f84:	c7 44 24 0c 04 00 00 	movl   $0x4,0xc(%esp)
  800f8b:	00 
  800f8c:	c7 44 24 08 4b 2b 80 	movl   $0x802b4b,0x8(%esp)
  800f93:	00 
  800f94:	c7 44 24 04 23 00 00 	movl   $0x23,0x4(%esp)
  800f9b:	00 
  800f9c:	c7 04 24 68 2b 80 00 	movl   $0x802b68,(%esp)
  800fa3:	e8 6c 14 00 00       	call   802414 <_panic>

int
sys_page_alloc(envid_t envid, void *va, int perm)
{
	return syscall(SYS_page_alloc, 1, envid, (uint32_t) va, perm, 0, 0);
}
  800fa8:	8b 5d f4             	mov    -0xc(%ebp),%ebx
  800fab:	8b 75 f8             	mov    -0x8(%ebp),%esi
  800fae:	8b 7d fc             	mov    -0x4(%ebp),%edi
  800fb1:	89 ec                	mov    %ebp,%esp
  800fb3:	5d                   	pop    %ebp
  800fb4:	c3                   	ret    

00800fb5 <sys_yield>:
	 return syscall(SYS_getenvid, 0, 0, 0, 0, 0, 0);
}

void
sys_yield(void)
{
  800fb5:	55                   	push   %ebp
  800fb6:	89 e5                	mov    %esp,%ebp
  800fb8:	83 ec 0c             	sub    $0xc,%esp
  800fbb:	89 1c 24             	mov    %ebx,(%esp)
  800fbe:	89 74 24 04          	mov    %esi,0x4(%esp)
  800fc2:	89 7c 24 08          	mov    %edi,0x8(%esp)
	// 
	// The last clause tells the assembler that this can
	// potentially change the condition codes and arbitrary
	// memory locations.

	asm volatile("int %1\n"
  800fc6:	ba 00 00 00 00       	mov    $0x0,%edx
  800fcb:	b8 0b 00 00 00       	mov    $0xb,%eax
  800fd0:	89 d1                	mov    %edx,%ecx
  800fd2:	89 d3                	mov    %edx,%ebx
  800fd4:	89 d7                	mov    %edx,%edi
  800fd6:	89 d6                	mov    %edx,%esi
  800fd8:	cd 30                	int    $0x30

void
sys_yield(void)
{
	syscall(SYS_yield, 0, 0, 0, 0, 0, 0);
}
  800fda:	8b 1c 24             	mov    (%esp),%ebx
  800fdd:	8b 74 24 04          	mov    0x4(%esp),%esi
  800fe1:	8b 7c 24 08          	mov    0x8(%esp),%edi
  800fe5:	89 ec                	mov    %ebp,%esp
  800fe7:	5d                   	pop    %ebp
  800fe8:	c3                   	ret    

00800fe9 <sys_getenvid>:
	return syscall(SYS_env_destroy, 1, envid, 0, 0, 0, 0);
}

envid_t
sys_getenvid(void)
{
  800fe9:	55                   	push   %ebp
  800fea:	89 e5                	mov    %esp,%ebp
  800fec:	83 ec 0c             	sub    $0xc,%esp
  800fef:	89 1c 24             	mov    %ebx,(%esp)
  800ff2:	89 74 24 04          	mov    %esi,0x4(%esp)
  800ff6:	89 7c 24 08          	mov    %edi,0x8(%esp)
	// 
	// The last clause tells the assembler that this can
	// potentially change the condition codes and arbitrary
	// memory locations.

	asm volatile("int %1\n"
  800ffa:	ba 00 00 00 00       	mov    $0x0,%edx
  800fff:	b8 02 00 00 00       	mov    $0x2,%eax
  801004:	89 d1                	mov    %edx,%ecx
  801006:	89 d3                	mov    %edx,%ebx
  801008:	89 d7                	mov    %edx,%edi
  80100a:	89 d6                	mov    %edx,%esi
  80100c:	cd 30                	int    $0x30

envid_t
sys_getenvid(void)
{
	 return syscall(SYS_getenvid, 0, 0, 0, 0, 0, 0);
}
  80100e:	8b 1c 24             	mov    (%esp),%ebx
  801011:	8b 74 24 04          	mov    0x4(%esp),%esi
  801015:	8b 7c 24 08          	mov    0x8(%esp),%edi
  801019:	89 ec                	mov    %ebp,%esp
  80101b:	5d                   	pop    %ebp
  80101c:	c3                   	ret    

0080101d <sys_env_destroy>:
	return syscall(SYS_cgetc, 0, 0, 0, 0, 0, 0);
}

int
sys_env_destroy(envid_t envid)
{
  80101d:	55                   	push   %ebp
  80101e:	89 e5                	mov    %esp,%ebp
  801020:	83 ec 38             	sub    $0x38,%esp
  801023:	89 5d f4             	mov    %ebx,-0xc(%ebp)
  801026:	89 75 f8             	mov    %esi,-0x8(%ebp)
  801029:	89 7d fc             	mov    %edi,-0x4(%ebp)
	// 
	// The last clause tells the assembler that this can
	// potentially change the condition codes and arbitrary
	// memory locations.

	asm volatile("int %1\n"
  80102c:	b9 00 00 00 00       	mov    $0x0,%ecx
  801031:	b8 03 00 00 00       	mov    $0x3,%eax
  801036:	8b 55 08             	mov    0x8(%ebp),%edx
  801039:	89 cb                	mov    %ecx,%ebx
  80103b:	89 cf                	mov    %ecx,%edi
  80103d:	89 ce                	mov    %ecx,%esi
  80103f:	cd 30                	int    $0x30
		  "b" (a3),
		  "D" (a4),
		  "S" (a5)
		: "cc", "memory");
	
	if(check && ret > 0)
  801041:	85 c0                	test   %eax,%eax
  801043:	7e 28                	jle    80106d <sys_env_destroy+0x50>
		panic("syscall %d returned %d (> 0)", num, ret);
  801045:	89 44 24 10          	mov    %eax,0x10(%esp)
  801049:	c7 44 24 0c 03 00 00 	movl   $0x3,0xc(%esp)
  801050:	00 
  801051:	c7 44 24 08 4b 2b 80 	movl   $0x802b4b,0x8(%esp)
  801058:	00 
  801059:	c7 44 24 04 23 00 00 	movl   $0x23,0x4(%esp)
  801060:	00 
  801061:	c7 04 24 68 2b 80 00 	movl   $0x802b68,(%esp)
  801068:	e8 a7 13 00 00       	call   802414 <_panic>

int
sys_env_destroy(envid_t envid)
{
	return syscall(SYS_env_destroy, 1, envid, 0, 0, 0, 0);
}
  80106d:	8b 5d f4             	mov    -0xc(%ebp),%ebx
  801070:	8b 75 f8             	mov    -0x8(%ebp),%esi
  801073:	8b 7d fc             	mov    -0x4(%ebp),%edi
  801076:	89 ec                	mov    %ebp,%esp
  801078:	5d                   	pop    %ebp
  801079:	c3                   	ret    
  80107a:	00 00                	add    %al,(%eax)
  80107c:	00 00                	add    %al,(%eax)
	...

00801080 <fd2num>:
// File descriptor manipulators
// --------------------------------------------------------------

int
fd2num(struct Fd *fd)
{
  801080:	55                   	push   %ebp
  801081:	89 e5                	mov    %esp,%ebp
  801083:	8b 45 08             	mov    0x8(%ebp),%eax
  801086:	05 00 00 00 30       	add    $0x30000000,%eax
  80108b:	c1 e8 0c             	shr    $0xc,%eax
	return ((uintptr_t) fd - FDTABLE) / PGSIZE;
}
  80108e:	5d                   	pop    %ebp
  80108f:	c3                   	ret    

00801090 <fd2data>:

char*
fd2data(struct Fd *fd)
{
  801090:	55                   	push   %ebp
  801091:	89 e5                	mov    %esp,%ebp
  801093:	83 ec 04             	sub    $0x4,%esp
	return INDEX2DATA(fd2num(fd));
  801096:	8b 45 08             	mov    0x8(%ebp),%eax
  801099:	89 04 24             	mov    %eax,(%esp)
  80109c:	e8 df ff ff ff       	call   801080 <fd2num>
  8010a1:	05 20 00 0d 00       	add    $0xd0020,%eax
  8010a6:	c1 e0 0c             	shl    $0xc,%eax
}
  8010a9:	c9                   	leave  
  8010aa:	c3                   	ret    

008010ab <fd_alloc>:
// Returns 0 on success, < 0 on error.  Errors are:
//	-E_MAX_FD: no more file descriptors
// On error, *fd_store is set to 0.
int
fd_alloc(struct Fd **fd_store)
{
  8010ab:	55                   	push   %ebp
  8010ac:	89 e5                	mov    %esp,%ebp
  8010ae:	57                   	push   %edi
  8010af:	56                   	push   %esi
  8010b0:	53                   	push   %ebx
  8010b1:	8b 7d 08             	mov    0x8(%ebp),%edi
	int i;
	struct Fd *fd;

	for (i = 0; i < MAXFD; i++) {
		fd = INDEX2FD(i);
		if ((vpd[PDX(fd)] & PTE_P) == 0 || (vpt[VPN(fd)] & PTE_P) == 0) {
  8010b4:	a1 00 dd 7b ef       	mov    0xef7bdd00,%eax
  8010b9:	a8 01                	test   $0x1,%al
  8010bb:	74 36                	je     8010f3 <fd_alloc+0x48>
  8010bd:	a1 00 00 74 ef       	mov    0xef740000,%eax
  8010c2:	a8 01                	test   $0x1,%al
  8010c4:	74 2d                	je     8010f3 <fd_alloc+0x48>
  8010c6:	b8 00 10 00 d0       	mov    $0xd0001000,%eax
  8010cb:	b9 00 d0 7b ef       	mov    $0xef7bd000,%ecx
  8010d0:	be 00 00 40 ef       	mov    $0xef400000,%esi
  8010d5:	89 c3                	mov    %eax,%ebx
  8010d7:	89 c2                	mov    %eax,%edx
  8010d9:	c1 ea 16             	shr    $0x16,%edx
  8010dc:	8b 14 91             	mov    (%ecx,%edx,4),%edx
  8010df:	f6 c2 01             	test   $0x1,%dl
  8010e2:	74 14                	je     8010f8 <fd_alloc+0x4d>
  8010e4:	89 c2                	mov    %eax,%edx
  8010e6:	c1 ea 0c             	shr    $0xc,%edx
  8010e9:	8b 14 96             	mov    (%esi,%edx,4),%edx
  8010ec:	f6 c2 01             	test   $0x1,%dl
  8010ef:	75 10                	jne    801101 <fd_alloc+0x56>
  8010f1:	eb 05                	jmp    8010f8 <fd_alloc+0x4d>
  8010f3:	bb 00 00 00 d0       	mov    $0xd0000000,%ebx
			*fd_store = fd;
  8010f8:	89 1f                	mov    %ebx,(%edi)
  8010fa:	b8 00 00 00 00       	mov    $0x0,%eax
			return 0;
  8010ff:	eb 17                	jmp    801118 <fd_alloc+0x6d>
  801101:	05 00 10 00 00       	add    $0x1000,%eax
fd_alloc(struct Fd **fd_store)
{
	int i;
	struct Fd *fd;

	for (i = 0; i < MAXFD; i++) {
  801106:	3d 00 00 02 d0       	cmp    $0xd0020000,%eax
  80110b:	75 c8                	jne    8010d5 <fd_alloc+0x2a>
		if ((vpd[PDX(fd)] & PTE_P) == 0 || (vpt[VPN(fd)] & PTE_P) == 0) {
			*fd_store = fd;
			return 0;
		}
	}
	*fd_store = 0;
  80110d:	c7 07 00 00 00 00    	movl   $0x0,(%edi)
  801113:	b8 f6 ff ff ff       	mov    $0xfffffff6,%eax
	return -E_MAX_OPEN;
}
  801118:	5b                   	pop    %ebx
  801119:	5e                   	pop    %esi
  80111a:	5f                   	pop    %edi
  80111b:	5d                   	pop    %ebp
  80111c:	c3                   	ret    

0080111d <fd_lookup>:
// Returns 0 on success (the page is in range and mapped), < 0 on error.
// Errors are:
//	-E_INVAL: fdnum was either not in range or not mapped.
int
fd_lookup(int fdnum, struct Fd **fd_store)
{
  80111d:	55                   	push   %ebp
  80111e:	89 e5                	mov    %esp,%ebp
	struct Fd *fd=NULL;

	if (fdnum < 0 || fdnum >= MAXFD) {
  801120:	8b 45 08             	mov    0x8(%ebp),%eax
  801123:	83 f8 1f             	cmp    $0x1f,%eax
  801126:	77 36                	ja     80115e <fd_lookup+0x41>
		if (debug)
			cprintf("[%08x] bad fd %d\n", env->env_id, fd);
		return -E_INVAL;
	}
	fd = INDEX2FD(fdnum);
  801128:	05 00 00 0d 00       	add    $0xd0000,%eax
  80112d:	c1 e0 0c             	shl    $0xc,%eax
	if (!(vpd[PDX(fd)] & PTE_P) || !(vpt[VPN(fd)] & PTE_P)) {
  801130:	89 c2                	mov    %eax,%edx
  801132:	c1 ea 16             	shr    $0x16,%edx
  801135:	8b 14 95 00 d0 7b ef 	mov    -0x10843000(,%edx,4),%edx
  80113c:	f6 c2 01             	test   $0x1,%dl
  80113f:	74 1d                	je     80115e <fd_lookup+0x41>
  801141:	89 c2                	mov    %eax,%edx
  801143:	c1 ea 0c             	shr    $0xc,%edx
  801146:	8b 14 95 00 00 40 ef 	mov    -0x10c00000(,%edx,4),%edx
  80114d:	f6 c2 01             	test   $0x1,%dl
  801150:	74 0c                	je     80115e <fd_lookup+0x41>
		if (debug)
			cprintf("[%08x] closed fd %d\n", env->env_id, fd);
		return -E_INVAL;
	}
	*fd_store = fd;
  801152:	8b 55 0c             	mov    0xc(%ebp),%edx
  801155:	89 02                	mov    %eax,(%edx)
  801157:	b8 00 00 00 00       	mov    $0x0,%eax
	return 0;
  80115c:	eb 05                	jmp    801163 <fd_lookup+0x46>
  80115e:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
}
  801163:	5d                   	pop    %ebp
  801164:	c3                   	ret    

00801165 <seek>:
	return (*dev->dev_write)(fd, buf, n);
}

int
seek(int fdnum, off_t offset)
{
  801165:	55                   	push   %ebp
  801166:	89 e5                	mov    %esp,%ebp
  801168:	83 ec 18             	sub    $0x18,%esp
	int r;
	struct Fd *fd;
	if ((r = fd_lookup(fdnum, &fd)) < 0)
  80116b:	8d 45 fc             	lea    -0x4(%ebp),%eax
  80116e:	89 44 24 04          	mov    %eax,0x4(%esp)
  801172:	8b 45 08             	mov    0x8(%ebp),%eax
  801175:	89 04 24             	mov    %eax,(%esp)
  801178:	e8 a0 ff ff ff       	call   80111d <fd_lookup>
  80117d:	85 c0                	test   %eax,%eax
  80117f:	78 0e                	js     80118f <seek+0x2a>
		return r;
	fd->fd_offset = offset;
  801181:	8b 45 fc             	mov    -0x4(%ebp),%eax
  801184:	8b 55 0c             	mov    0xc(%ebp),%edx
  801187:	89 50 04             	mov    %edx,0x4(%eax)
  80118a:	b8 00 00 00 00       	mov    $0x0,%eax
	return 0;
}
  80118f:	c9                   	leave  
  801190:	c3                   	ret    

00801191 <dev_lookup>:
	0
};

int
dev_lookup(int dev_id, struct Dev **dev)
{
  801191:	55                   	push   %ebp
  801192:	89 e5                	mov    %esp,%ebp
  801194:	56                   	push   %esi
  801195:	53                   	push   %ebx
  801196:	83 ec 10             	sub    $0x10,%esp
  801199:	8b 4d 08             	mov    0x8(%ebp),%ecx
  80119c:	8b 5d 0c             	mov    0xc(%ebp),%ebx
	int i;
	for (i = 0; devtab[i]; i++)
		if (devtab[i]->dev_id == dev_id) {
			*dev = devtab[i];
			return 0;
  80119f:	ba 00 00 00 00       	mov    $0x0,%edx
int
dev_lookup(int dev_id, struct Dev **dev)
{
	int i;
	for (i = 0; devtab[i]; i++)
		if (devtab[i]->dev_id == dev_id) {
  8011a4:	b8 04 60 80 00       	mov    $0x806004,%eax
  8011a9:	39 0d 04 60 80 00    	cmp    %ecx,0x806004
  8011af:	75 11                	jne    8011c2 <dev_lookup+0x31>
  8011b1:	eb 04                	jmp    8011b7 <dev_lookup+0x26>
  8011b3:	39 08                	cmp    %ecx,(%eax)
  8011b5:	75 10                	jne    8011c7 <dev_lookup+0x36>
			*dev = devtab[i];
  8011b7:	89 03                	mov    %eax,(%ebx)
  8011b9:	b8 00 00 00 00       	mov    $0x0,%eax
			return 0;
  8011be:	66 90                	xchg   %ax,%ax
  8011c0:	eb 36                	jmp    8011f8 <dev_lookup+0x67>

int
dev_lookup(int dev_id, struct Dev **dev)
{
	int i;
	for (i = 0; devtab[i]; i++)
  8011c2:	be f4 2b 80 00       	mov    $0x802bf4,%esi
  8011c7:	83 c2 01             	add    $0x1,%edx
  8011ca:	8b 04 96             	mov    (%esi,%edx,4),%eax
  8011cd:	85 c0                	test   %eax,%eax
  8011cf:	75 e2                	jne    8011b3 <dev_lookup+0x22>
		if (devtab[i]->dev_id == dev_id) {
			*dev = devtab[i];
			return 0;
		}
	cprintf("[%08x] unknown device type %d\n", env->env_id, dev_id);
  8011d1:	a1 74 60 80 00       	mov    0x806074,%eax
  8011d6:	8b 40 4c             	mov    0x4c(%eax),%eax
  8011d9:	89 4c 24 08          	mov    %ecx,0x8(%esp)
  8011dd:	89 44 24 04          	mov    %eax,0x4(%esp)
  8011e1:	c7 04 24 78 2b 80 00 	movl   $0x802b78,(%esp)
  8011e8:	e8 40 ef ff ff       	call   80012d <cprintf>
	*dev = 0;
  8011ed:	c7 03 00 00 00 00    	movl   $0x0,(%ebx)
  8011f3:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
	return -E_INVAL;
}
  8011f8:	83 c4 10             	add    $0x10,%esp
  8011fb:	5b                   	pop    %ebx
  8011fc:	5e                   	pop    %esi
  8011fd:	5d                   	pop    %ebp
  8011fe:	c3                   	ret    

008011ff <fstat>:
	return (*dev->dev_trunc)(fd, newsize);
}

int
fstat(int fdnum, struct Stat *stat)
{
  8011ff:	55                   	push   %ebp
  801200:	89 e5                	mov    %esp,%ebp
  801202:	53                   	push   %ebx
  801203:	83 ec 24             	sub    $0x24,%esp
  801206:	8b 5d 0c             	mov    0xc(%ebp),%ebx
	int r;
	struct Dev *dev;
	struct Fd *fd;

	if ((r = fd_lookup(fdnum, &fd)) < 0
  801209:	8d 45 f0             	lea    -0x10(%ebp),%eax
  80120c:	89 44 24 04          	mov    %eax,0x4(%esp)
  801210:	8b 45 08             	mov    0x8(%ebp),%eax
  801213:	89 04 24             	mov    %eax,(%esp)
  801216:	e8 02 ff ff ff       	call   80111d <fd_lookup>
  80121b:	85 c0                	test   %eax,%eax
  80121d:	78 53                	js     801272 <fstat+0x73>
	    || (r = dev_lookup(fd->fd_dev_id, &dev)) < 0)
  80121f:	8d 45 f4             	lea    -0xc(%ebp),%eax
  801222:	89 44 24 04          	mov    %eax,0x4(%esp)
  801226:	8b 45 f0             	mov    -0x10(%ebp),%eax
  801229:	8b 00                	mov    (%eax),%eax
  80122b:	89 04 24             	mov    %eax,(%esp)
  80122e:	e8 5e ff ff ff       	call   801191 <dev_lookup>
{
	int r;
	struct Dev *dev;
	struct Fd *fd;

	if ((r = fd_lookup(fdnum, &fd)) < 0
  801233:	85 c0                	test   %eax,%eax
  801235:	78 3b                	js     801272 <fstat+0x73>
	    || (r = dev_lookup(fd->fd_dev_id, &dev)) < 0)
		return r;
	if (!dev->dev_stat)
  801237:	b8 f1 ff ff ff       	mov    $0xfffffff1,%eax
  80123c:	8b 55 f4             	mov    -0xc(%ebp),%edx
  80123f:	83 7a 14 00          	cmpl   $0x0,0x14(%edx)
  801243:	74 2d                	je     801272 <fstat+0x73>
		return -E_NOT_SUPP;
	stat->st_name[0] = 0;
  801245:	c6 03 00             	movb   $0x0,(%ebx)
	stat->st_size = 0;
  801248:	c7 83 80 00 00 00 00 	movl   $0x0,0x80(%ebx)
  80124f:	00 00 00 
	stat->st_isdir = 0;
  801252:	c7 83 84 00 00 00 00 	movl   $0x0,0x84(%ebx)
  801259:	00 00 00 
	stat->st_dev = dev;
  80125c:	8b 45 f4             	mov    -0xc(%ebp),%eax
  80125f:	89 83 88 00 00 00    	mov    %eax,0x88(%ebx)
	return (*dev->dev_stat)(fd, stat);
  801265:	89 5c 24 04          	mov    %ebx,0x4(%esp)
  801269:	8b 55 f0             	mov    -0x10(%ebp),%edx
  80126c:	89 14 24             	mov    %edx,(%esp)
  80126f:	ff 50 14             	call   *0x14(%eax)
}
  801272:	83 c4 24             	add    $0x24,%esp
  801275:	5b                   	pop    %ebx
  801276:	5d                   	pop    %ebp
  801277:	c3                   	ret    

00801278 <ftruncate>:
	return 0;
}

int
ftruncate(int fdnum, off_t newsize)
{
  801278:	55                   	push   %ebp
  801279:	89 e5                	mov    %esp,%ebp
  80127b:	53                   	push   %ebx
  80127c:	83 ec 24             	sub    $0x24,%esp
  80127f:	8b 5d 08             	mov    0x8(%ebp),%ebx
	int r;
	struct Dev *dev;
	struct Fd *fd;
	if ((r = fd_lookup(fdnum, &fd)) < 0
  801282:	8d 45 f0             	lea    -0x10(%ebp),%eax
  801285:	89 44 24 04          	mov    %eax,0x4(%esp)
  801289:	89 1c 24             	mov    %ebx,(%esp)
  80128c:	e8 8c fe ff ff       	call   80111d <fd_lookup>
  801291:	85 c0                	test   %eax,%eax
  801293:	78 5f                	js     8012f4 <ftruncate+0x7c>
	    || (r = dev_lookup(fd->fd_dev_id, &dev)) < 0)
  801295:	8d 45 f4             	lea    -0xc(%ebp),%eax
  801298:	89 44 24 04          	mov    %eax,0x4(%esp)
  80129c:	8b 45 f0             	mov    -0x10(%ebp),%eax
  80129f:	8b 00                	mov    (%eax),%eax
  8012a1:	89 04 24             	mov    %eax,(%esp)
  8012a4:	e8 e8 fe ff ff       	call   801191 <dev_lookup>
ftruncate(int fdnum, off_t newsize)
{
	int r;
	struct Dev *dev;
	struct Fd *fd;
	if ((r = fd_lookup(fdnum, &fd)) < 0
  8012a9:	85 c0                	test   %eax,%eax
  8012ab:	78 47                	js     8012f4 <ftruncate+0x7c>
	    || (r = dev_lookup(fd->fd_dev_id, &dev)) < 0)
		return r;
	if ((fd->fd_omode & O_ACCMODE) == O_RDONLY) {
  8012ad:	8b 55 f0             	mov    -0x10(%ebp),%edx
  8012b0:	f6 42 08 03          	testb  $0x3,0x8(%edx)
  8012b4:	75 23                	jne    8012d9 <ftruncate+0x61>
		cprintf("[%08x] ftruncate %d -- bad mode\n",
			env->env_id, fdnum); 
  8012b6:	a1 74 60 80 00       	mov    0x806074,%eax
	struct Fd *fd;
	if ((r = fd_lookup(fdnum, &fd)) < 0
	    || (r = dev_lookup(fd->fd_dev_id, &dev)) < 0)
		return r;
	if ((fd->fd_omode & O_ACCMODE) == O_RDONLY) {
		cprintf("[%08x] ftruncate %d -- bad mode\n",
  8012bb:	8b 40 4c             	mov    0x4c(%eax),%eax
  8012be:	89 5c 24 08          	mov    %ebx,0x8(%esp)
  8012c2:	89 44 24 04          	mov    %eax,0x4(%esp)
  8012c6:	c7 04 24 98 2b 80 00 	movl   $0x802b98,(%esp)
  8012cd:	e8 5b ee ff ff       	call   80012d <cprintf>
  8012d2:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
			env->env_id, fdnum); 
		return -E_INVAL;
  8012d7:	eb 1b                	jmp    8012f4 <ftruncate+0x7c>
	}
	if (!dev->dev_trunc)
  8012d9:	8b 45 f4             	mov    -0xc(%ebp),%eax
  8012dc:	8b 48 18             	mov    0x18(%eax),%ecx
  8012df:	b8 f1 ff ff ff       	mov    $0xfffffff1,%eax
  8012e4:	85 c9                	test   %ecx,%ecx
  8012e6:	74 0c                	je     8012f4 <ftruncate+0x7c>
		return -E_NOT_SUPP;
	return (*dev->dev_trunc)(fd, newsize);
  8012e8:	8b 45 0c             	mov    0xc(%ebp),%eax
  8012eb:	89 44 24 04          	mov    %eax,0x4(%esp)
  8012ef:	89 14 24             	mov    %edx,(%esp)
  8012f2:	ff d1                	call   *%ecx
}
  8012f4:	83 c4 24             	add    $0x24,%esp
  8012f7:	5b                   	pop    %ebx
  8012f8:	5d                   	pop    %ebp
  8012f9:	c3                   	ret    

008012fa <write>:
	return tot;
}

ssize_t
write(int fdnum, const void *buf, size_t n)
{
  8012fa:	55                   	push   %ebp
  8012fb:	89 e5                	mov    %esp,%ebp
  8012fd:	53                   	push   %ebx
  8012fe:	83 ec 24             	sub    $0x24,%esp
  801301:	8b 5d 08             	mov    0x8(%ebp),%ebx
	int r;
	struct Dev *dev;
	struct Fd *fd;

	if ((r = fd_lookup(fdnum, &fd)) < 0
  801304:	8d 45 f0             	lea    -0x10(%ebp),%eax
  801307:	89 44 24 04          	mov    %eax,0x4(%esp)
  80130b:	89 1c 24             	mov    %ebx,(%esp)
  80130e:	e8 0a fe ff ff       	call   80111d <fd_lookup>
  801313:	85 c0                	test   %eax,%eax
  801315:	78 66                	js     80137d <write+0x83>
	    || (r = dev_lookup(fd->fd_dev_id, &dev)) < 0)
  801317:	8d 45 f4             	lea    -0xc(%ebp),%eax
  80131a:	89 44 24 04          	mov    %eax,0x4(%esp)
  80131e:	8b 45 f0             	mov    -0x10(%ebp),%eax
  801321:	8b 00                	mov    (%eax),%eax
  801323:	89 04 24             	mov    %eax,(%esp)
  801326:	e8 66 fe ff ff       	call   801191 <dev_lookup>
{
	int r;
	struct Dev *dev;
	struct Fd *fd;

	if ((r = fd_lookup(fdnum, &fd)) < 0
  80132b:	85 c0                	test   %eax,%eax
  80132d:	78 4e                	js     80137d <write+0x83>
	    || (r = dev_lookup(fd->fd_dev_id, &dev)) < 0)
		return r;
	if ((fd->fd_omode & O_ACCMODE) == O_RDONLY) {
  80132f:	8b 55 f0             	mov    -0x10(%ebp),%edx
  801332:	f6 42 08 03          	testb  $0x3,0x8(%edx)
  801336:	75 23                	jne    80135b <write+0x61>
		cprintf("[%08x] write %d -- bad mode\n", env->env_id, fdnum);
  801338:	a1 74 60 80 00       	mov    0x806074,%eax
  80133d:	8b 40 4c             	mov    0x4c(%eax),%eax
  801340:	89 5c 24 08          	mov    %ebx,0x8(%esp)
  801344:	89 44 24 04          	mov    %eax,0x4(%esp)
  801348:	c7 04 24 b9 2b 80 00 	movl   $0x802bb9,(%esp)
  80134f:	e8 d9 ed ff ff       	call   80012d <cprintf>
  801354:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
		return -E_INVAL;
  801359:	eb 22                	jmp    80137d <write+0x83>
	}
	if (debug)
		cprintf("write %d %p %d via dev %s\n",
			fdnum, buf, n, dev->dev_name);
	if (!dev->dev_write)
  80135b:	8b 45 f4             	mov    -0xc(%ebp),%eax
  80135e:	8b 48 0c             	mov    0xc(%eax),%ecx
  801361:	b8 f1 ff ff ff       	mov    $0xfffffff1,%eax
  801366:	85 c9                	test   %ecx,%ecx
  801368:	74 13                	je     80137d <write+0x83>
		return -E_NOT_SUPP;
	return (*dev->dev_write)(fd, buf, n);
  80136a:	8b 45 10             	mov    0x10(%ebp),%eax
  80136d:	89 44 24 08          	mov    %eax,0x8(%esp)
  801371:	8b 45 0c             	mov    0xc(%ebp),%eax
  801374:	89 44 24 04          	mov    %eax,0x4(%esp)
  801378:	89 14 24             	mov    %edx,(%esp)
  80137b:	ff d1                	call   *%ecx
}
  80137d:	83 c4 24             	add    $0x24,%esp
  801380:	5b                   	pop    %ebx
  801381:	5d                   	pop    %ebp
  801382:	c3                   	ret    

00801383 <read>:
	return r;
}

ssize_t
read(int fdnum, void *buf, size_t n)
{
  801383:	55                   	push   %ebp
  801384:	89 e5                	mov    %esp,%ebp
  801386:	57                   	push   %edi
  801387:	56                   	push   %esi
  801388:	53                   	push   %ebx
  801389:	83 ec 2c             	sub    $0x2c,%esp
  80138c:	8b 5d 08             	mov    0x8(%ebp),%ebx
  80138f:	8b 75 10             	mov    0x10(%ebp),%esi
	int r;
	int m, tot;
	struct Dev *dev;
	struct Fd *fd;

	if ((r = fd_lookup(fdnum, &fd)) < 0
  801392:	8d 45 e0             	lea    -0x20(%ebp),%eax
  801395:	89 44 24 04          	mov    %eax,0x4(%esp)
  801399:	89 1c 24             	mov    %ebx,(%esp)
  80139c:	e8 7c fd ff ff       	call   80111d <fd_lookup>
  8013a1:	85 c0                	test   %eax,%eax
  8013a3:	0f 88 b0 00 00 00    	js     801459 <read+0xd6>
	    || (r = dev_lookup(fd->fd_dev_id, &dev)) < 0)
  8013a9:	8d 45 e4             	lea    -0x1c(%ebp),%eax
  8013ac:	89 44 24 04          	mov    %eax,0x4(%esp)
  8013b0:	8b 45 e0             	mov    -0x20(%ebp),%eax
  8013b3:	8b 00                	mov    (%eax),%eax
  8013b5:	89 04 24             	mov    %eax,(%esp)
  8013b8:	e8 d4 fd ff ff       	call   801191 <dev_lookup>
	int r;
	int m, tot;
	struct Dev *dev;
	struct Fd *fd;

	if ((r = fd_lookup(fdnum, &fd)) < 0
  8013bd:	85 c0                	test   %eax,%eax
  8013bf:	0f 88 94 00 00 00    	js     801459 <read+0xd6>
	    || (r = dev_lookup(fd->fd_dev_id, &dev)) < 0)
		return r;
	if ((fd->fd_omode & O_ACCMODE) == O_WRONLY) {
  8013c5:	8b 45 e0             	mov    -0x20(%ebp),%eax
  8013c8:	8b 40 08             	mov    0x8(%eax),%eax
  8013cb:	83 e0 03             	and    $0x3,%eax
  8013ce:	83 f8 01             	cmp    $0x1,%eax
  8013d1:	75 23                	jne    8013f6 <read+0x73>
		cprintf("[%08x] read %d -- bad mode\n", env->env_id, fdnum); 
  8013d3:	a1 74 60 80 00       	mov    0x806074,%eax
  8013d8:	8b 40 4c             	mov    0x4c(%eax),%eax
  8013db:	89 5c 24 08          	mov    %ebx,0x8(%esp)
  8013df:	89 44 24 04          	mov    %eax,0x4(%esp)
  8013e3:	c7 04 24 d6 2b 80 00 	movl   $0x802bd6,(%esp)
  8013ea:	e8 3e ed ff ff       	call   80012d <cprintf>
  8013ef:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
		return -E_INVAL;
  8013f4:	eb 63                	jmp    801459 <read+0xd6>
	}
	if (!dev->dev_read)
  8013f6:	b8 f1 ff ff ff       	mov    $0xfffffff1,%eax
  8013fb:	8b 55 e4             	mov    -0x1c(%ebp),%edx
  8013fe:	83 7a 08 00          	cmpl   $0x0,0x8(%edx)
  801402:	74 55                	je     801459 <read+0xd6>
		return -E_NOT_SUPP;

  for (tot = 0; tot < n; tot += m) {
  801404:	ba 00 00 00 00       	mov    $0x0,%edx
  801409:	bb 00 00 00 00       	mov    $0x0,%ebx
  80140e:	b8 00 00 00 00       	mov    $0x0,%eax
  801413:	85 f6                	test   %esi,%esi
  801415:	74 42                	je     801459 <read+0xd6>
    int count=0;
    if ((n-tot)/PGSIZE == 0)
  801417:	bf 00 10 00 00       	mov    $0x1000,%edi
  80141c:	89 f0                	mov    %esi,%eax
  80141e:	29 d0                	sub    %edx,%eax
  801420:	89 c1                	mov    %eax,%ecx
  801422:	81 e1 ff 0f 00 00    	and    $0xfff,%ecx
  801428:	3d 00 10 00 00       	cmp    $0x1000,%eax
  80142d:	0f 43 cf             	cmovae %edi,%ecx
      count = (n-tot)%PGSIZE;
    else
      count = PGSIZE;

	  m = (*dev->dev_read)(fd, (char *)buf + tot, count);
  801430:	89 4c 24 08          	mov    %ecx,0x8(%esp)
  801434:	03 55 0c             	add    0xc(%ebp),%edx
  801437:	89 54 24 04          	mov    %edx,0x4(%esp)
  80143b:	8b 45 e0             	mov    -0x20(%ebp),%eax
  80143e:	89 04 24             	mov    %eax,(%esp)
  801441:	8b 45 e4             	mov    -0x1c(%ebp),%eax
  801444:	ff 50 08             	call   *0x8(%eax)
		if (m < 0)
  801447:	85 c0                	test   %eax,%eax
  801449:	78 0e                	js     801459 <read+0xd6>
			return m;
		if (m == 0)
  80144b:	85 c0                	test   %eax,%eax
  80144d:	74 08                	je     801457 <read+0xd4>
		return -E_INVAL;
	}
	if (!dev->dev_read)
		return -E_NOT_SUPP;

  for (tot = 0; tot < n; tot += m) {
  80144f:	01 c3                	add    %eax,%ebx
  801451:	89 da                	mov    %ebx,%edx
  801453:	39 f3                	cmp    %esi,%ebx
  801455:	72 c5                	jb     80141c <read+0x99>
  801457:	89 d8                	mov    %ebx,%eax
			return m;
		if (m == 0)
			break;
	}
	return tot;
}
  801459:	83 c4 2c             	add    $0x2c,%esp
  80145c:	5b                   	pop    %ebx
  80145d:	5e                   	pop    %esi
  80145e:	5f                   	pop    %edi
  80145f:	5d                   	pop    %ebp
  801460:	c3                   	ret    

00801461 <readn>:

ssize_t
readn(int fdnum, void *buf, size_t n)
{
  801461:	55                   	push   %ebp
  801462:	89 e5                	mov    %esp,%ebp
  801464:	57                   	push   %edi
  801465:	56                   	push   %esi
  801466:	53                   	push   %ebx
  801467:	83 ec 1c             	sub    $0x1c,%esp
  80146a:	8b 7d 08             	mov    0x8(%ebp),%edi
  80146d:	8b 75 10             	mov    0x10(%ebp),%esi
	int m, tot;
  struct Fd *fd = INDEX2FD(fdnum);

	for (tot = 0; tot < n; tot += m) {
  801470:	ba 00 00 00 00       	mov    $0x0,%edx
  801475:	bb 00 00 00 00       	mov    $0x0,%ebx
  80147a:	b8 00 00 00 00       	mov    $0x0,%eax
  80147f:	85 f6                	test   %esi,%esi
  801481:	74 29                	je     8014ac <readn+0x4b>
		m = read(fdnum, (char*)buf + tot, n - tot);
  801483:	89 f0                	mov    %esi,%eax
  801485:	29 d0                	sub    %edx,%eax
  801487:	89 44 24 08          	mov    %eax,0x8(%esp)
  80148b:	03 55 0c             	add    0xc(%ebp),%edx
  80148e:	89 54 24 04          	mov    %edx,0x4(%esp)
  801492:	89 3c 24             	mov    %edi,(%esp)
  801495:	e8 e9 fe ff ff       	call   801383 <read>
		if (m < 0)
  80149a:	85 c0                	test   %eax,%eax
  80149c:	78 0e                	js     8014ac <readn+0x4b>
			return m;
		if (m == 0)
  80149e:	85 c0                	test   %eax,%eax
  8014a0:	74 08                	je     8014aa <readn+0x49>
readn(int fdnum, void *buf, size_t n)
{
	int m, tot;
  struct Fd *fd = INDEX2FD(fdnum);

	for (tot = 0; tot < n; tot += m) {
  8014a2:	01 c3                	add    %eax,%ebx
  8014a4:	89 da                	mov    %ebx,%edx
  8014a6:	39 f3                	cmp    %esi,%ebx
  8014a8:	72 d9                	jb     801483 <readn+0x22>
  8014aa:	89 d8                	mov    %ebx,%eax
			return m;
		if (m == 0)
			break;
	}
	return tot;
}
  8014ac:	83 c4 1c             	add    $0x1c,%esp
  8014af:	5b                   	pop    %ebx
  8014b0:	5e                   	pop    %esi
  8014b1:	5f                   	pop    %edi
  8014b2:	5d                   	pop    %ebp
  8014b3:	c3                   	ret    

008014b4 <fd_close>:
// If 'must_exist' is 1, then fd_close returns -E_INVAL when passed a
// closed or nonexistent file descriptor.
// Returns 0 on success, < 0 on error.
int
fd_close(struct Fd *fd, bool must_exist)
{
  8014b4:	55                   	push   %ebp
  8014b5:	89 e5                	mov    %esp,%ebp
  8014b7:	83 ec 28             	sub    $0x28,%esp
  8014ba:	89 5d f8             	mov    %ebx,-0x8(%ebp)
  8014bd:	89 75 fc             	mov    %esi,-0x4(%ebp)
  8014c0:	8b 75 08             	mov    0x8(%ebp),%esi
	struct Fd *fd2;
	struct Dev *dev;
	int r;
	if ((r = fd_lookup(fd2num(fd), &fd2)) < 0
  8014c3:	89 34 24             	mov    %esi,(%esp)
  8014c6:	e8 b5 fb ff ff       	call   801080 <fd2num>
  8014cb:	8d 55 f4             	lea    -0xc(%ebp),%edx
  8014ce:	89 54 24 04          	mov    %edx,0x4(%esp)
  8014d2:	89 04 24             	mov    %eax,(%esp)
  8014d5:	e8 43 fc ff ff       	call   80111d <fd_lookup>
  8014da:	89 c3                	mov    %eax,%ebx
  8014dc:	85 c0                	test   %eax,%eax
  8014de:	78 05                	js     8014e5 <fd_close+0x31>
  8014e0:	3b 75 f4             	cmp    -0xc(%ebp),%esi
  8014e3:	74 0e                	je     8014f3 <fd_close+0x3f>
	    || fd != fd2)
		return (must_exist ? r : 0);
  8014e5:	83 7d 0c 00          	cmpl   $0x0,0xc(%ebp)
  8014e9:	b8 00 00 00 00       	mov    $0x0,%eax
  8014ee:	0f 44 d8             	cmove  %eax,%ebx
  8014f1:	eb 3d                	jmp    801530 <fd_close+0x7c>
	if ((r = dev_lookup(fd->fd_dev_id, &dev)) >= 0) {
  8014f3:	8d 45 f0             	lea    -0x10(%ebp),%eax
  8014f6:	89 44 24 04          	mov    %eax,0x4(%esp)
  8014fa:	8b 06                	mov    (%esi),%eax
  8014fc:	89 04 24             	mov    %eax,(%esp)
  8014ff:	e8 8d fc ff ff       	call   801191 <dev_lookup>
  801504:	89 c3                	mov    %eax,%ebx
  801506:	85 c0                	test   %eax,%eax
  801508:	78 16                	js     801520 <fd_close+0x6c>
		if (dev->dev_close)
  80150a:	8b 45 f0             	mov    -0x10(%ebp),%eax
  80150d:	8b 40 10             	mov    0x10(%eax),%eax
  801510:	bb 00 00 00 00       	mov    $0x0,%ebx
  801515:	85 c0                	test   %eax,%eax
  801517:	74 07                	je     801520 <fd_close+0x6c>
			r = (*dev->dev_close)(fd);
  801519:	89 34 24             	mov    %esi,(%esp)
  80151c:	ff d0                	call   *%eax
  80151e:	89 c3                	mov    %eax,%ebx
		else
			r = 0;
	}
	// Make sure fd is unmapped.  Might be a no-op if
	// (*dev->dev_close)(fd) already unmapped it.
	(void) sys_page_unmap(0, fd);
  801520:	89 74 24 04          	mov    %esi,0x4(%esp)
  801524:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
  80152b:	e8 6a f9 ff ff       	call   800e9a <sys_page_unmap>
	return r;
}
  801530:	89 d8                	mov    %ebx,%eax
  801532:	8b 5d f8             	mov    -0x8(%ebp),%ebx
  801535:	8b 75 fc             	mov    -0x4(%ebp),%esi
  801538:	89 ec                	mov    %ebp,%esp
  80153a:	5d                   	pop    %ebp
  80153b:	c3                   	ret    

0080153c <close>:
	return -E_INVAL;
}

int
close(int fdnum)
{
  80153c:	55                   	push   %ebp
  80153d:	89 e5                	mov    %esp,%ebp
  80153f:	83 ec 28             	sub    $0x28,%esp
	struct Fd *fd;
	int r;

	if ((r = fd_lookup(fdnum, &fd)) < 0)
  801542:	8d 45 f4             	lea    -0xc(%ebp),%eax
  801545:	89 44 24 04          	mov    %eax,0x4(%esp)
  801549:	8b 45 08             	mov    0x8(%ebp),%eax
  80154c:	89 04 24             	mov    %eax,(%esp)
  80154f:	e8 c9 fb ff ff       	call   80111d <fd_lookup>
  801554:	85 c0                	test   %eax,%eax
  801556:	78 13                	js     80156b <close+0x2f>
		return r;
	else
		return fd_close(fd, 1);
  801558:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
  80155f:	00 
  801560:	8b 45 f4             	mov    -0xc(%ebp),%eax
  801563:	89 04 24             	mov    %eax,(%esp)
  801566:	e8 49 ff ff ff       	call   8014b4 <fd_close>
}
  80156b:	c9                   	leave  
  80156c:	c3                   	ret    

0080156d <stat>:
	return (*dev->dev_stat)(fd, stat);
}

int
stat(const char *path, struct Stat *stat)
{
  80156d:	55                   	push   %ebp
  80156e:	89 e5                	mov    %esp,%ebp
  801570:	83 ec 18             	sub    $0x18,%esp
  801573:	89 5d f8             	mov    %ebx,-0x8(%ebp)
  801576:	89 75 fc             	mov    %esi,-0x4(%ebp)
	int fd, r;

	if ((fd = open(path, O_RDONLY)) < 0)
  801579:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
  801580:	00 
  801581:	8b 45 08             	mov    0x8(%ebp),%eax
  801584:	89 04 24             	mov    %eax,(%esp)
  801587:	e8 80 03 00 00       	call   80190c <open>
  80158c:	89 c3                	mov    %eax,%ebx
  80158e:	85 c0                	test   %eax,%eax
  801590:	78 1b                	js     8015ad <stat+0x40>
		return fd;
	r = fstat(fd, stat);
  801592:	8b 45 0c             	mov    0xc(%ebp),%eax
  801595:	89 44 24 04          	mov    %eax,0x4(%esp)
  801599:	89 1c 24             	mov    %ebx,(%esp)
  80159c:	e8 5e fc ff ff       	call   8011ff <fstat>
  8015a1:	89 c6                	mov    %eax,%esi
	close(fd);
  8015a3:	89 1c 24             	mov    %ebx,(%esp)
  8015a6:	e8 91 ff ff ff       	call   80153c <close>
  8015ab:	89 f3                	mov    %esi,%ebx
	return r;
}
  8015ad:	89 d8                	mov    %ebx,%eax
  8015af:	8b 5d f8             	mov    -0x8(%ebp),%ebx
  8015b2:	8b 75 fc             	mov    -0x4(%ebp),%esi
  8015b5:	89 ec                	mov    %ebp,%esp
  8015b7:	5d                   	pop    %ebp
  8015b8:	c3                   	ret    

008015b9 <close_all>:
		return fd_close(fd, 1);
}

void
close_all(void)
{
  8015b9:	55                   	push   %ebp
  8015ba:	89 e5                	mov    %esp,%ebp
  8015bc:	53                   	push   %ebx
  8015bd:	83 ec 14             	sub    $0x14,%esp
  8015c0:	bb 00 00 00 00       	mov    $0x0,%ebx
	int i;
	for (i = 0; i < MAXFD; i++)
		close(i);
  8015c5:	89 1c 24             	mov    %ebx,(%esp)
  8015c8:	e8 6f ff ff ff       	call   80153c <close>

void
close_all(void)
{
	int i;
	for (i = 0; i < MAXFD; i++)
  8015cd:	83 c3 01             	add    $0x1,%ebx
  8015d0:	83 fb 20             	cmp    $0x20,%ebx
  8015d3:	75 f0                	jne    8015c5 <close_all+0xc>
		close(i);
}
  8015d5:	83 c4 14             	add    $0x14,%esp
  8015d8:	5b                   	pop    %ebx
  8015d9:	5d                   	pop    %ebp
  8015da:	c3                   	ret    

008015db <dup>:
// file and the file offset of the other.
// Closes any previously open file descriptor at 'newfdnum'.
// This is implemented using virtual memory tricks (of course!).
int
dup(int oldfdnum, int newfdnum)
{
  8015db:	55                   	push   %ebp
  8015dc:	89 e5                	mov    %esp,%ebp
  8015de:	83 ec 58             	sub    $0x58,%esp
  8015e1:	89 5d f4             	mov    %ebx,-0xc(%ebp)
  8015e4:	89 75 f8             	mov    %esi,-0x8(%ebp)
  8015e7:	89 7d fc             	mov    %edi,-0x4(%ebp)
  8015ea:	8b 7d 0c             	mov    0xc(%ebp),%edi
	int r;
	char *ova, *nva;
	pte_t pte;
	struct Fd *oldfd, *newfd;

	if ((r = fd_lookup(oldfdnum, &oldfd)) < 0)
  8015ed:	8d 45 e4             	lea    -0x1c(%ebp),%eax
  8015f0:	89 44 24 04          	mov    %eax,0x4(%esp)
  8015f4:	8b 45 08             	mov    0x8(%ebp),%eax
  8015f7:	89 04 24             	mov    %eax,(%esp)
  8015fa:	e8 1e fb ff ff       	call   80111d <fd_lookup>
  8015ff:	89 c3                	mov    %eax,%ebx
  801601:	85 c0                	test   %eax,%eax
  801603:	0f 88 e0 00 00 00    	js     8016e9 <dup+0x10e>
		return r;
	close(newfdnum);
  801609:	89 3c 24             	mov    %edi,(%esp)
  80160c:	e8 2b ff ff ff       	call   80153c <close>

	newfd = INDEX2FD(newfdnum);
  801611:	8d b7 00 00 0d 00    	lea    0xd0000(%edi),%esi
  801617:	c1 e6 0c             	shl    $0xc,%esi
	ova = fd2data(oldfd);
  80161a:	8b 45 e4             	mov    -0x1c(%ebp),%eax
  80161d:	89 04 24             	mov    %eax,(%esp)
  801620:	e8 6b fa ff ff       	call   801090 <fd2data>
  801625:	89 c3                	mov    %eax,%ebx
	nva = fd2data(newfd);
  801627:	89 34 24             	mov    %esi,(%esp)
  80162a:	e8 61 fa ff ff       	call   801090 <fd2data>
  80162f:	89 45 d4             	mov    %eax,-0x2c(%ebp)
	if ((vpd[PDX(ova)] & PTE_P) && (vpt[VPN(ova)] & PTE_P))
  801632:	89 da                	mov    %ebx,%edx
  801634:	89 d8                	mov    %ebx,%eax
  801636:	c1 e8 16             	shr    $0x16,%eax
  801639:	8b 04 85 00 d0 7b ef 	mov    -0x10843000(,%eax,4),%eax
  801640:	a8 01                	test   $0x1,%al
  801642:	74 43                	je     801687 <dup+0xac>
  801644:	c1 ea 0c             	shr    $0xc,%edx
  801647:	8b 04 95 00 00 40 ef 	mov    -0x10c00000(,%edx,4),%eax
  80164e:	a8 01                	test   $0x1,%al
  801650:	74 35                	je     801687 <dup+0xac>
		if ((r = sys_page_map(0, ova, 0, nva, (vpt[VPN(ova)]) & PTE_USER)) < 0)
  801652:	8b 04 95 00 00 40 ef 	mov    -0x10c00000(,%edx,4),%eax
  801659:	25 07 0e 00 00       	and    $0xe07,%eax
  80165e:	89 44 24 10          	mov    %eax,0x10(%esp)
  801662:	8b 45 d4             	mov    -0x2c(%ebp),%eax
  801665:	89 44 24 0c          	mov    %eax,0xc(%esp)
  801669:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
  801670:	00 
  801671:	89 5c 24 04          	mov    %ebx,0x4(%esp)
  801675:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
  80167c:	e8 77 f8 ff ff       	call   800ef8 <sys_page_map>
  801681:	89 c3                	mov    %eax,%ebx
  801683:	85 c0                	test   %eax,%eax
  801685:	78 3f                	js     8016c6 <dup+0xeb>
			goto err;
	if ((r = sys_page_map(0, oldfd, 0, newfd, (vpt[VPN(oldfd)]) & PTE_USER)) < 0)
  801687:	8b 45 e4             	mov    -0x1c(%ebp),%eax
  80168a:	89 c2                	mov    %eax,%edx
  80168c:	c1 ea 0c             	shr    $0xc,%edx
  80168f:	8b 14 95 00 00 40 ef 	mov    -0x10c00000(,%edx,4),%edx
  801696:	81 e2 07 0e 00 00    	and    $0xe07,%edx
  80169c:	89 54 24 10          	mov    %edx,0x10(%esp)
  8016a0:	89 74 24 0c          	mov    %esi,0xc(%esp)
  8016a4:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
  8016ab:	00 
  8016ac:	89 44 24 04          	mov    %eax,0x4(%esp)
  8016b0:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
  8016b7:	e8 3c f8 ff ff       	call   800ef8 <sys_page_map>
  8016bc:	89 c3                	mov    %eax,%ebx
  8016be:	85 c0                	test   %eax,%eax
  8016c0:	78 04                	js     8016c6 <dup+0xeb>
  8016c2:	89 fb                	mov    %edi,%ebx
  8016c4:	eb 23                	jmp    8016e9 <dup+0x10e>
		goto err;

	return newfdnum;
err:
	sys_page_unmap(0, newfd);
  8016c6:	89 74 24 04          	mov    %esi,0x4(%esp)
  8016ca:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
  8016d1:	e8 c4 f7 ff ff       	call   800e9a <sys_page_unmap>
	sys_page_unmap(0, nva);
  8016d6:	8b 45 d4             	mov    -0x2c(%ebp),%eax
  8016d9:	89 44 24 04          	mov    %eax,0x4(%esp)
  8016dd:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
  8016e4:	e8 b1 f7 ff ff       	call   800e9a <sys_page_unmap>
	return r;
}
  8016e9:	89 d8                	mov    %ebx,%eax
  8016eb:	8b 5d f4             	mov    -0xc(%ebp),%ebx
  8016ee:	8b 75 f8             	mov    -0x8(%ebp),%esi
  8016f1:	8b 7d fc             	mov    -0x4(%ebp),%edi
  8016f4:	89 ec                	mov    %ebp,%esp
  8016f6:	5d                   	pop    %ebp
  8016f7:	c3                   	ret    

008016f8 <fsipc>:
// type: request code, passed as the simple integer IPC value.
// dstva: virtual address at which to receive reply page, 0 if none.
// Returns result from the file server.
static int
fsipc(unsigned type, void *dstva)
{
  8016f8:	55                   	push   %ebp
  8016f9:	89 e5                	mov    %esp,%ebp
  8016fb:	53                   	push   %ebx
  8016fc:	83 ec 14             	sub    $0x14,%esp
  8016ff:	89 d3                	mov    %edx,%ebx
	if (debug)
		cprintf("[%08x] fsipc %d %08x\n", env->env_id, type, *(uint32_t *)&fsipcbuf);

	ipc_send(envs[1].env_id, type, &fsipcbuf, PTE_P | PTE_W | PTE_U);
  801701:	8b 15 c8 00 c0 ee    	mov    0xeec000c8,%edx
  801707:	c7 44 24 0c 07 00 00 	movl   $0x7,0xc(%esp)
  80170e:	00 
  80170f:	c7 44 24 08 00 30 80 	movl   $0x803000,0x8(%esp)
  801716:	00 
  801717:	89 44 24 04          	mov    %eax,0x4(%esp)
  80171b:	89 14 24             	mov    %edx,(%esp)
  80171e:	e8 5d 0d 00 00       	call   802480 <ipc_send>
	return ipc_recv(NULL, dstva, NULL);
  801723:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
  80172a:	00 
  80172b:	89 5c 24 04          	mov    %ebx,0x4(%esp)
  80172f:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
  801736:	e8 b7 0d 00 00       	call   8024f2 <ipc_recv>
}
  80173b:	83 c4 14             	add    $0x14,%esp
  80173e:	5b                   	pop    %ebx
  80173f:	5d                   	pop    %ebp
  801740:	c3                   	ret    

00801741 <devfile_trunc>:
}

// Truncate or extend an open file to 'size' bytes
static int
devfile_trunc(struct Fd *fd, off_t newsize)
{
  801741:	55                   	push   %ebp
  801742:	89 e5                	mov    %esp,%ebp
  801744:	83 ec 08             	sub    $0x8,%esp
	fsipcbuf.set_size.req_fileid = fd->fd_file.id;
  801747:	8b 45 08             	mov    0x8(%ebp),%eax
  80174a:	8b 40 0c             	mov    0xc(%eax),%eax
  80174d:	a3 00 30 80 00       	mov    %eax,0x803000
	fsipcbuf.set_size.req_size = newsize;
  801752:	8b 45 0c             	mov    0xc(%ebp),%eax
  801755:	a3 04 30 80 00       	mov    %eax,0x803004
	return fsipc(FSREQ_SET_SIZE, NULL);
  80175a:	ba 00 00 00 00       	mov    $0x0,%edx
  80175f:	b8 02 00 00 00       	mov    $0x2,%eax
  801764:	e8 8f ff ff ff       	call   8016f8 <fsipc>
}
  801769:	c9                   	leave  
  80176a:	c3                   	ret    

0080176b <devfile_flush>:
// open, unmapping it is enough to free up server-side resources.
// Other than that, we just have to make sure our changes are flushed
// to disk.
static int
devfile_flush(struct Fd *fd)
{
  80176b:	55                   	push   %ebp
  80176c:	89 e5                	mov    %esp,%ebp
  80176e:	83 ec 08             	sub    $0x8,%esp
	fsipcbuf.flush.req_fileid = fd->fd_file.id;
  801771:	8b 45 08             	mov    0x8(%ebp),%eax
  801774:	8b 40 0c             	mov    0xc(%eax),%eax
  801777:	a3 00 30 80 00       	mov    %eax,0x803000
	return fsipc(FSREQ_FLUSH, NULL);
  80177c:	ba 00 00 00 00       	mov    $0x0,%edx
  801781:	b8 06 00 00 00       	mov    $0x6,%eax
  801786:	e8 6d ff ff ff       	call   8016f8 <fsipc>
}
  80178b:	c9                   	leave  
  80178c:	c3                   	ret    

0080178d <sync>:
}

// Synchronize disk with buffer cache
int
sync(void)
{
  80178d:	55                   	push   %ebp
  80178e:	89 e5                	mov    %esp,%ebp
  801790:	83 ec 08             	sub    $0x8,%esp
	// Ask the file server to update the disk
	// by writing any dirty blocks in the buffer cache.

	return fsipc(FSREQ_SYNC, NULL);
  801793:	ba 00 00 00 00       	mov    $0x0,%edx
  801798:	b8 08 00 00 00       	mov    $0x8,%eax
  80179d:	e8 56 ff ff ff       	call   8016f8 <fsipc>
}
  8017a2:	c9                   	leave  
  8017a3:	c3                   	ret    

008017a4 <devfile_stat>:
    return n;
}

static int
devfile_stat(struct Fd *fd, struct Stat *st)
{
  8017a4:	55                   	push   %ebp
  8017a5:	89 e5                	mov    %esp,%ebp
  8017a7:	53                   	push   %ebx
  8017a8:	83 ec 14             	sub    $0x14,%esp
  8017ab:	8b 5d 0c             	mov    0xc(%ebp),%ebx
	int r;

	fsipcbuf.stat.req_fileid = fd->fd_file.id;
  8017ae:	8b 45 08             	mov    0x8(%ebp),%eax
  8017b1:	8b 40 0c             	mov    0xc(%eax),%eax
  8017b4:	a3 00 30 80 00       	mov    %eax,0x803000
	if ((r = fsipc(FSREQ_STAT, NULL)) < 0)
  8017b9:	ba 00 00 00 00       	mov    $0x0,%edx
  8017be:	b8 05 00 00 00       	mov    $0x5,%eax
  8017c3:	e8 30 ff ff ff       	call   8016f8 <fsipc>
  8017c8:	85 c0                	test   %eax,%eax
  8017ca:	78 2b                	js     8017f7 <devfile_stat+0x53>
		return r;
	strcpy(st->st_name, fsipcbuf.statRet.ret_name);
  8017cc:	c7 44 24 04 00 30 80 	movl   $0x803000,0x4(%esp)
  8017d3:	00 
  8017d4:	89 1c 24             	mov    %ebx,(%esp)
  8017d7:	e8 1e f0 ff ff       	call   8007fa <strcpy>
	st->st_size = fsipcbuf.statRet.ret_size;
  8017dc:	a1 80 30 80 00       	mov    0x803080,%eax
  8017e1:	89 83 80 00 00 00    	mov    %eax,0x80(%ebx)
	st->st_isdir = fsipcbuf.statRet.ret_isdir;
  8017e7:	a1 84 30 80 00       	mov    0x803084,%eax
  8017ec:	89 83 84 00 00 00    	mov    %eax,0x84(%ebx)
  8017f2:	b8 00 00 00 00       	mov    $0x0,%eax
	return 0;
}
  8017f7:	83 c4 14             	add    $0x14,%esp
  8017fa:	5b                   	pop    %ebx
  8017fb:	5d                   	pop    %ebp
  8017fc:	c3                   	ret    

008017fd <devfile_write>:
// Returns:
//	 The number of bytes successfully written.
//	 < 0 on error.
static ssize_t
devfile_write(struct Fd *fd, const void *buf, size_t n)
{
  8017fd:	55                   	push   %ebp
  8017fe:	89 e5                	mov    %esp,%ebp
  801800:	53                   	push   %ebx
  801801:	83 ec 14             	sub    $0x14,%esp
  801804:	8b 45 08             	mov    0x8(%ebp),%eax
  801807:	8b 55 0c             	mov    0xc(%ebp),%edx
  80180a:	8b 5d 10             	mov    0x10(%ebp),%ebx
	// careful: fsipcbuf.write.req_buf is only so large, but
	// remember that write is always allowed to write *fewer*
	// bytes than requested.
	// LAB 5: Your code here
    int r;
    if (!fd || !buf || (n>(PGSIZE-sizeof(size_t)-sizeof(int))))
  80180d:	85 c0                	test   %eax,%eax
  80180f:	74 44                	je     801855 <devfile_write+0x58>
  801811:	85 d2                	test   %edx,%edx
  801813:	74 40                	je     801855 <devfile_write+0x58>
  801815:	81 fb f8 0f 00 00    	cmp    $0xff8,%ebx
  80181b:	77 38                	ja     801855 <devfile_write+0x58>
        return -E_INVAL;

    fsipcbuf.write.req_fileid   = fd->fd_file.id;
  80181d:	8b 40 0c             	mov    0xc(%eax),%eax
  801820:	a3 00 30 80 00       	mov    %eax,0x803000
    fsipcbuf.write.req_n        = n;
  801825:	89 1d 04 30 80 00    	mov    %ebx,0x803004
    memmove(fsipcbuf.write.req_buf, buf, n);
  80182b:	89 5c 24 08          	mov    %ebx,0x8(%esp)
  80182f:	89 54 24 04          	mov    %edx,0x4(%esp)
  801833:	c7 04 24 08 30 80 00 	movl   $0x803008,(%esp)
  80183a:	e8 76 f1 ff ff       	call   8009b5 <memmove>
    if ((r=fsipc(FSREQ_WRITE, NULL))<0)
  80183f:	ba 00 00 00 00       	mov    $0x0,%edx
  801844:	b8 04 00 00 00       	mov    $0x4,%eax
  801849:	e8 aa fe ff ff       	call   8016f8 <fsipc>
        return r;
    return n;
  80184e:	85 c0                	test   %eax,%eax
  801850:	0f 49 c3             	cmovns %ebx,%eax
  801853:	eb 05                	jmp    80185a <devfile_write+0x5d>
  801855:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
}
  80185a:	83 c4 14             	add    $0x14,%esp
  80185d:	5b                   	pop    %ebx
  80185e:	5d                   	pop    %ebp
  80185f:	c3                   	ret    

00801860 <devfile_read>:
// Returns:
// 	The number of bytes successfully read.
// 	< 0 on error.
static ssize_t
devfile_read(struct Fd *fd, void *buf, size_t n)
{
  801860:	55                   	push   %ebp
  801861:	89 e5                	mov    %esp,%ebp
  801863:	83 ec 18             	sub    $0x18,%esp
  801866:	89 5d f8             	mov    %ebx,-0x8(%ebp)
  801869:	89 75 fc             	mov    %esi,-0x4(%ebp)
  80186c:	8b 45 08             	mov    0x8(%ebp),%eax
  80186f:	8b 75 0c             	mov    0xc(%ebp),%esi
	// filling fsipcbuf.read with the request arguments.  The
	// bytes read will be written back to fsipcbuf by the file
	// system server.
	// LAB 5: Your code here
  int r;
  if (!fd || !buf)
  801872:	85 c0                	test   %eax,%eax
  801874:	74 04                	je     80187a <devfile_read+0x1a>
  801876:	85 f6                	test   %esi,%esi
  801878:	75 07                	jne    801881 <devfile_read+0x21>
  80187a:	bb fd ff ff ff       	mov    $0xfffffffd,%ebx
  80187f:	eb 39                	jmp    8018ba <devfile_read+0x5a>
    return -E_INVAL;

  fsipcbuf.read.req_fileid    = fd->fd_file.id;
  801881:	8b 40 0c             	mov    0xc(%eax),%eax
  801884:	a3 00 30 80 00       	mov    %eax,0x803000
  fsipcbuf.read.req_n         = n;
  801889:	8b 45 10             	mov    0x10(%ebp),%eax
  80188c:	a3 04 30 80 00       	mov    %eax,0x803004
  if ((r=fsipc(FSREQ_READ, NULL))<0)
  801891:	ba 00 00 00 00       	mov    $0x0,%edx
  801896:	b8 03 00 00 00       	mov    $0x3,%eax
  80189b:	e8 58 fe ff ff       	call   8016f8 <fsipc>
  8018a0:	89 c3                	mov    %eax,%ebx
  8018a2:	85 c0                	test   %eax,%eax
  8018a4:	78 14                	js     8018ba <devfile_read+0x5a>
    return r;

  memmove(buf, fsipcbuf.readRet.ret_buf, r);
  8018a6:	89 44 24 08          	mov    %eax,0x8(%esp)
  8018aa:	c7 44 24 04 00 30 80 	movl   $0x803000,0x4(%esp)
  8018b1:	00 
  8018b2:	89 34 24             	mov    %esi,(%esp)
  8018b5:	e8 fb f0 ff ff       	call   8009b5 <memmove>
  return r;
}
  8018ba:	89 d8                	mov    %ebx,%eax
  8018bc:	8b 5d f8             	mov    -0x8(%ebp),%ebx
  8018bf:	8b 75 fc             	mov    -0x4(%ebp),%esi
  8018c2:	89 ec                	mov    %ebp,%esp
  8018c4:	5d                   	pop    %ebp
  8018c5:	c3                   	ret    

008018c6 <remove>:
}

// Delete a file
int
remove(const char *path)
{
  8018c6:	55                   	push   %ebp
  8018c7:	89 e5                	mov    %esp,%ebp
  8018c9:	53                   	push   %ebx
  8018ca:	83 ec 14             	sub    $0x14,%esp
  8018cd:	8b 5d 08             	mov    0x8(%ebp),%ebx
	if (strlen(path) >= MAXPATHLEN)
  8018d0:	89 1c 24             	mov    %ebx,(%esp)
  8018d3:	e8 d8 ee ff ff       	call   8007b0 <strlen>
  8018d8:	89 c2                	mov    %eax,%edx
  8018da:	b8 f4 ff ff ff       	mov    $0xfffffff4,%eax
  8018df:	81 fa ff 03 00 00    	cmp    $0x3ff,%edx
  8018e5:	7f 1f                	jg     801906 <remove+0x40>
		return -E_BAD_PATH;
	strcpy(fsipcbuf.remove.req_path, path);
  8018e7:	89 5c 24 04          	mov    %ebx,0x4(%esp)
  8018eb:	c7 04 24 00 30 80 00 	movl   $0x803000,(%esp)
  8018f2:	e8 03 ef ff ff       	call   8007fa <strcpy>
	return fsipc(FSREQ_REMOVE, NULL);
  8018f7:	ba 00 00 00 00       	mov    $0x0,%edx
  8018fc:	b8 07 00 00 00       	mov    $0x7,%eax
  801901:	e8 f2 fd ff ff       	call   8016f8 <fsipc>
}
  801906:	83 c4 14             	add    $0x14,%esp
  801909:	5b                   	pop    %ebx
  80190a:	5d                   	pop    %ebp
  80190b:	c3                   	ret    

0080190c <open>:
// 	The file descriptor index on success
// 	-E_BAD_PATH if the path is too long (>= MAXPATHLEN)
// 	< 0 for other errors.
int
open(const char *path, int mode)
{
  80190c:	55                   	push   %ebp
  80190d:	89 e5                	mov    %esp,%ebp
  80190f:	83 ec 28             	sub    $0x28,%esp
  801912:	89 5d f8             	mov    %ebx,-0x8(%ebp)
  801915:	89 75 fc             	mov    %esi,-0x4(%ebp)
  801918:	8b 75 08             	mov    0x8(%ebp),%esi
	// Return the file descriptor index.
	// If any step after fd_alloc fails, use fd_close to free the
  struct Fd *f    = NULL;
  int r   = 0;

  if (!path)
  80191b:	bb fd ff ff ff       	mov    $0xfffffffd,%ebx
  801920:	85 f6                	test   %esi,%esi
  801922:	74 65                	je     801989 <open+0x7d>
	// (fd_alloc does not allocate a page, it just returns an
	// unused fd address.  Do you need to allocate a page?)
	//
	// Return the file descriptor index.
	// If any step after fd_alloc fails, use fd_close to free the
  struct Fd *f    = NULL;
  801924:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
  int r   = 0;

  if (!path)
    return -E_INVAL;
  if((r=fd_alloc(&f))<0)
  80192b:	8d 45 f4             	lea    -0xc(%ebp),%eax
  80192e:	89 04 24             	mov    %eax,(%esp)
  801931:	e8 75 f7 ff ff       	call   8010ab <fd_alloc>
  801936:	89 c3                	mov    %eax,%ebx
  801938:	85 c0                	test   %eax,%eax
  80193a:	78 4d                	js     801989 <open+0x7d>
    return r;

	strcpy(fsipcbuf.open.req_path, path);
  80193c:	89 74 24 04          	mov    %esi,0x4(%esp)
  801940:	c7 04 24 00 30 80 00 	movl   $0x803000,(%esp)
  801947:	e8 ae ee ff ff       	call   8007fa <strcpy>
	fsipcbuf.open.req_omode = mode;
  80194c:	8b 45 0c             	mov    0xc(%ebp),%eax
  80194f:	a3 00 34 80 00       	mov    %eax,0x803400

  if ((r=fsipc(FSREQ_OPEN, f))<0) {
  801954:	8b 55 f4             	mov    -0xc(%ebp),%edx
  801957:	b8 01 00 00 00       	mov    $0x1,%eax
  80195c:	e8 97 fd ff ff       	call   8016f8 <fsipc>
  801961:	89 c3                	mov    %eax,%ebx
  801963:	85 c0                	test   %eax,%eax
  801965:	79 15                	jns    80197c <open+0x70>
    fd_close(f, 0);
  801967:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
  80196e:	00 
  80196f:	8b 45 f4             	mov    -0xc(%ebp),%eax
  801972:	89 04 24             	mov    %eax,(%esp)
  801975:	e8 3a fb ff ff       	call   8014b4 <fd_close>
    return r;
  80197a:	eb 0d                	jmp    801989 <open+0x7d>
  }
  return fd2num(f);
  80197c:	8b 45 f4             	mov    -0xc(%ebp),%eax
  80197f:	89 04 24             	mov    %eax,(%esp)
  801982:	e8 f9 f6 ff ff       	call   801080 <fd2num>
  801987:	89 c3                	mov    %eax,%ebx
}
  801989:	89 d8                	mov    %ebx,%eax
  80198b:	8b 5d f8             	mov    -0x8(%ebp),%ebx
  80198e:	8b 75 fc             	mov    -0x4(%ebp),%esi
  801991:	89 ec                	mov    %ebp,%esp
  801993:	5d                   	pop    %ebp
  801994:	c3                   	ret    
	...

008019a0 <devsock_stat>:
	return nsipc_send(fd->fd_sock.sockid, buf, n, 0);
}

static int
devsock_stat(struct Fd *fd, struct Stat *stat)
{
  8019a0:	55                   	push   %ebp
  8019a1:	89 e5                	mov    %esp,%ebp
  8019a3:	83 ec 18             	sub    $0x18,%esp
	strcpy(stat->st_name, "<sock>");
  8019a6:	c7 44 24 04 08 2c 80 	movl   $0x802c08,0x4(%esp)
  8019ad:	00 
  8019ae:	8b 45 0c             	mov    0xc(%ebp),%eax
  8019b1:	89 04 24             	mov    %eax,(%esp)
  8019b4:	e8 41 ee ff ff       	call   8007fa <strcpy>
	return 0;
}
  8019b9:	b8 00 00 00 00       	mov    $0x0,%eax
  8019be:	c9                   	leave  
  8019bf:	c3                   	ret    

008019c0 <devsock_close>:
	return nsipc_shutdown(r, how);
}

static int
devsock_close(struct Fd *fd)
{
  8019c0:	55                   	push   %ebp
  8019c1:	89 e5                	mov    %esp,%ebp
  8019c3:	83 ec 18             	sub    $0x18,%esp
	return nsipc_close(fd->fd_sock.sockid);
  8019c6:	8b 45 08             	mov    0x8(%ebp),%eax
  8019c9:	8b 40 0c             	mov    0xc(%eax),%eax
  8019cc:	89 04 24             	mov    %eax,(%esp)
  8019cf:	e8 9d 02 00 00       	call   801c71 <nsipc_close>
}
  8019d4:	c9                   	leave  
  8019d5:	c3                   	ret    

008019d6 <devsock_write>:
	return nsipc_recv(fd->fd_sock.sockid, buf, n, 0);
}

static ssize_t
devsock_write(struct Fd *fd, const void *buf, size_t n)
{
  8019d6:	55                   	push   %ebp
  8019d7:	89 e5                	mov    %esp,%ebp
  8019d9:	83 ec 18             	sub    $0x18,%esp
	return nsipc_send(fd->fd_sock.sockid, buf, n, 0);
  8019dc:	c7 44 24 0c 00 00 00 	movl   $0x0,0xc(%esp)
  8019e3:	00 
  8019e4:	8b 45 10             	mov    0x10(%ebp),%eax
  8019e7:	89 44 24 08          	mov    %eax,0x8(%esp)
  8019eb:	8b 45 0c             	mov    0xc(%ebp),%eax
  8019ee:	89 44 24 04          	mov    %eax,0x4(%esp)
  8019f2:	8b 45 08             	mov    0x8(%ebp),%eax
  8019f5:	8b 40 0c             	mov    0xc(%eax),%eax
  8019f8:	89 04 24             	mov    %eax,(%esp)
  8019fb:	e8 ad 02 00 00       	call   801cad <nsipc_send>
}
  801a00:	c9                   	leave  
  801a01:	c3                   	ret    

00801a02 <devsock_read>:
	return nsipc_listen(r, backlog);
}

static ssize_t
devsock_read(struct Fd *fd, void *buf, size_t n)
{
  801a02:	55                   	push   %ebp
  801a03:	89 e5                	mov    %esp,%ebp
  801a05:	83 ec 18             	sub    $0x18,%esp
	return nsipc_recv(fd->fd_sock.sockid, buf, n, 0);
  801a08:	c7 44 24 0c 00 00 00 	movl   $0x0,0xc(%esp)
  801a0f:	00 
  801a10:	8b 45 10             	mov    0x10(%ebp),%eax
  801a13:	89 44 24 08          	mov    %eax,0x8(%esp)
  801a17:	8b 45 0c             	mov    0xc(%ebp),%eax
  801a1a:	89 44 24 04          	mov    %eax,0x4(%esp)
  801a1e:	8b 45 08             	mov    0x8(%ebp),%eax
  801a21:	8b 40 0c             	mov    0xc(%eax),%eax
  801a24:	89 04 24             	mov    %eax,(%esp)
  801a27:	e8 f4 02 00 00       	call   801d20 <nsipc_recv>
}
  801a2c:	c9                   	leave  
  801a2d:	c3                   	ret    

00801a2e <alloc_sockfd>:
	return sfd->fd_sock.sockid;
}

static int
alloc_sockfd(int sockid)
{
  801a2e:	55                   	push   %ebp
  801a2f:	89 e5                	mov    %esp,%ebp
  801a31:	56                   	push   %esi
  801a32:	53                   	push   %ebx
  801a33:	83 ec 20             	sub    $0x20,%esp
  801a36:	89 c6                	mov    %eax,%esi
	struct Fd *sfd;
	int r;

	if ((r = fd_alloc(&sfd)) < 0
  801a38:	8d 45 f4             	lea    -0xc(%ebp),%eax
  801a3b:	89 04 24             	mov    %eax,(%esp)
  801a3e:	e8 68 f6 ff ff       	call   8010ab <fd_alloc>
  801a43:	89 c3                	mov    %eax,%ebx
  801a45:	85 c0                	test   %eax,%eax
  801a47:	78 21                	js     801a6a <alloc_sockfd+0x3c>
	    || (r = sys_page_alloc(0, sfd, PTE_P|PTE_W|PTE_U)) < 0) {
  801a49:	c7 44 24 08 07 00 00 	movl   $0x7,0x8(%esp)
  801a50:	00 
  801a51:	8b 45 f4             	mov    -0xc(%ebp),%eax
  801a54:	89 44 24 04          	mov    %eax,0x4(%esp)
  801a58:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
  801a5f:	e8 f2 f4 ff ff       	call   800f56 <sys_page_alloc>
  801a64:	89 c3                	mov    %eax,%ebx
alloc_sockfd(int sockid)
{
	struct Fd *sfd;
	int r;

	if ((r = fd_alloc(&sfd)) < 0
  801a66:	85 c0                	test   %eax,%eax
  801a68:	79 0a                	jns    801a74 <alloc_sockfd+0x46>
	    || (r = sys_page_alloc(0, sfd, PTE_P|PTE_W|PTE_U)) < 0) {
		nsipc_close(sockid);
  801a6a:	89 34 24             	mov    %esi,(%esp)
  801a6d:	e8 ff 01 00 00       	call   801c71 <nsipc_close>
		return r;
  801a72:	eb 28                	jmp    801a9c <alloc_sockfd+0x6e>
	}

	sfd->fd_dev_id = devsock.dev_id;
  801a74:	8b 15 20 60 80 00    	mov    0x806020,%edx
  801a7a:	8b 45 f4             	mov    -0xc(%ebp),%eax
  801a7d:	89 10                	mov    %edx,(%eax)
	sfd->fd_omode = O_RDWR;
  801a7f:	8b 45 f4             	mov    -0xc(%ebp),%eax
  801a82:	c7 40 08 02 00 00 00 	movl   $0x2,0x8(%eax)
	sfd->fd_sock.sockid = sockid;
  801a89:	8b 45 f4             	mov    -0xc(%ebp),%eax
  801a8c:	89 70 0c             	mov    %esi,0xc(%eax)
	return fd2num(sfd);
  801a8f:	8b 45 f4             	mov    -0xc(%ebp),%eax
  801a92:	89 04 24             	mov    %eax,(%esp)
  801a95:	e8 e6 f5 ff ff       	call   801080 <fd2num>
  801a9a:	89 c3                	mov    %eax,%ebx
}
  801a9c:	89 d8                	mov    %ebx,%eax
  801a9e:	83 c4 20             	add    $0x20,%esp
  801aa1:	5b                   	pop    %ebx
  801aa2:	5e                   	pop    %esi
  801aa3:	5d                   	pop    %ebp
  801aa4:	c3                   	ret    

00801aa5 <socket>:
	return 0;
}

int
socket(int domain, int type, int protocol)
{
  801aa5:	55                   	push   %ebp
  801aa6:	89 e5                	mov    %esp,%ebp
  801aa8:	83 ec 18             	sub    $0x18,%esp
	int r;
	if ((r = nsipc_socket(domain, type, protocol)) < 0)
  801aab:	8b 45 10             	mov    0x10(%ebp),%eax
  801aae:	89 44 24 08          	mov    %eax,0x8(%esp)
  801ab2:	8b 45 0c             	mov    0xc(%ebp),%eax
  801ab5:	89 44 24 04          	mov    %eax,0x4(%esp)
  801ab9:	8b 45 08             	mov    0x8(%ebp),%eax
  801abc:	89 04 24             	mov    %eax,(%esp)
  801abf:	e8 61 01 00 00       	call   801c25 <nsipc_socket>
  801ac4:	85 c0                	test   %eax,%eax
  801ac6:	78 05                	js     801acd <socket+0x28>
		return r;
	return alloc_sockfd(r);
  801ac8:	e8 61 ff ff ff       	call   801a2e <alloc_sockfd>
}
  801acd:	c9                   	leave  
  801ace:	66 90                	xchg   %ax,%ax
  801ad0:	c3                   	ret    

00801ad1 <fd2sockid>:
	.dev_stat =	devsock_stat,
};

static int
fd2sockid(int fd)
{
  801ad1:	55                   	push   %ebp
  801ad2:	89 e5                	mov    %esp,%ebp
  801ad4:	83 ec 28             	sub    $0x28,%esp
	struct Fd *sfd;
	int r;

	if ((r = fd_lookup(fd, &sfd)) < 0)
  801ad7:	8d 55 f4             	lea    -0xc(%ebp),%edx
  801ada:	89 54 24 04          	mov    %edx,0x4(%esp)
  801ade:	89 04 24             	mov    %eax,(%esp)
  801ae1:	e8 37 f6 ff ff       	call   80111d <fd_lookup>
  801ae6:	85 c0                	test   %eax,%eax
  801ae8:	78 15                	js     801aff <fd2sockid+0x2e>
		return r;
	if (sfd->fd_dev_id != devsock.dev_id)
  801aea:	8b 55 f4             	mov    -0xc(%ebp),%edx
  801aed:	8b 0a                	mov    (%edx),%ecx
  801aef:	b8 f1 ff ff ff       	mov    $0xfffffff1,%eax
  801af4:	3b 0d 20 60 80 00    	cmp    0x806020,%ecx
  801afa:	75 03                	jne    801aff <fd2sockid+0x2e>
		return -E_NOT_SUPP;
	return sfd->fd_sock.sockid;
  801afc:	8b 42 0c             	mov    0xc(%edx),%eax
}
  801aff:	c9                   	leave  
  801b00:	c3                   	ret    

00801b01 <listen>:
	return nsipc_connect(r, name, namelen);
}

int
listen(int s, int backlog)
{
  801b01:	55                   	push   %ebp
  801b02:	89 e5                	mov    %esp,%ebp
  801b04:	83 ec 18             	sub    $0x18,%esp
	int r;
	if ((r = fd2sockid(s)) < 0)
  801b07:	8b 45 08             	mov    0x8(%ebp),%eax
  801b0a:	e8 c2 ff ff ff       	call   801ad1 <fd2sockid>
  801b0f:	85 c0                	test   %eax,%eax
  801b11:	78 0f                	js     801b22 <listen+0x21>
		return r;
	return nsipc_listen(r, backlog);
  801b13:	8b 55 0c             	mov    0xc(%ebp),%edx
  801b16:	89 54 24 04          	mov    %edx,0x4(%esp)
  801b1a:	89 04 24             	mov    %eax,(%esp)
  801b1d:	e8 2d 01 00 00       	call   801c4f <nsipc_listen>
}
  801b22:	c9                   	leave  
  801b23:	c3                   	ret    

00801b24 <connect>:
	return nsipc_close(fd->fd_sock.sockid);
}

int
connect(int s, const struct sockaddr *name, socklen_t namelen)
{
  801b24:	55                   	push   %ebp
  801b25:	89 e5                	mov    %esp,%ebp
  801b27:	83 ec 18             	sub    $0x18,%esp
	int r;
	if ((r = fd2sockid(s)) < 0)
  801b2a:	8b 45 08             	mov    0x8(%ebp),%eax
  801b2d:	e8 9f ff ff ff       	call   801ad1 <fd2sockid>
  801b32:	85 c0                	test   %eax,%eax
  801b34:	78 16                	js     801b4c <connect+0x28>
		return r;
	return nsipc_connect(r, name, namelen);
  801b36:	8b 55 10             	mov    0x10(%ebp),%edx
  801b39:	89 54 24 08          	mov    %edx,0x8(%esp)
  801b3d:	8b 55 0c             	mov    0xc(%ebp),%edx
  801b40:	89 54 24 04          	mov    %edx,0x4(%esp)
  801b44:	89 04 24             	mov    %eax,(%esp)
  801b47:	e8 54 02 00 00       	call   801da0 <nsipc_connect>
}
  801b4c:	c9                   	leave  
  801b4d:	c3                   	ret    

00801b4e <shutdown>:
	return nsipc_bind(r, name, namelen);
}

int
shutdown(int s, int how)
{
  801b4e:	55                   	push   %ebp
  801b4f:	89 e5                	mov    %esp,%ebp
  801b51:	83 ec 18             	sub    $0x18,%esp
	int r;
	if ((r = fd2sockid(s)) < 0)
  801b54:	8b 45 08             	mov    0x8(%ebp),%eax
  801b57:	e8 75 ff ff ff       	call   801ad1 <fd2sockid>
  801b5c:	85 c0                	test   %eax,%eax
  801b5e:	78 0f                	js     801b6f <shutdown+0x21>
		return r;
	return nsipc_shutdown(r, how);
  801b60:	8b 55 0c             	mov    0xc(%ebp),%edx
  801b63:	89 54 24 04          	mov    %edx,0x4(%esp)
  801b67:	89 04 24             	mov    %eax,(%esp)
  801b6a:	e8 1c 01 00 00       	call   801c8b <nsipc_shutdown>
}
  801b6f:	c9                   	leave  
  801b70:	c3                   	ret    

00801b71 <bind>:
	return alloc_sockfd(r);
}

int
bind(int s, struct sockaddr *name, socklen_t namelen)
{
  801b71:	55                   	push   %ebp
  801b72:	89 e5                	mov    %esp,%ebp
  801b74:	83 ec 18             	sub    $0x18,%esp
	int r;
	if ((r = fd2sockid(s)) < 0)
  801b77:	8b 45 08             	mov    0x8(%ebp),%eax
  801b7a:	e8 52 ff ff ff       	call   801ad1 <fd2sockid>
  801b7f:	85 c0                	test   %eax,%eax
  801b81:	78 16                	js     801b99 <bind+0x28>
		return r;
	return nsipc_bind(r, name, namelen);
  801b83:	8b 55 10             	mov    0x10(%ebp),%edx
  801b86:	89 54 24 08          	mov    %edx,0x8(%esp)
  801b8a:	8b 55 0c             	mov    0xc(%ebp),%edx
  801b8d:	89 54 24 04          	mov    %edx,0x4(%esp)
  801b91:	89 04 24             	mov    %eax,(%esp)
  801b94:	e8 46 02 00 00       	call   801ddf <nsipc_bind>
}
  801b99:	c9                   	leave  
  801b9a:	c3                   	ret    

00801b9b <accept>:
	return fd2num(sfd);
}

int
accept(int s, struct sockaddr *addr, socklen_t *addrlen)
{
  801b9b:	55                   	push   %ebp
  801b9c:	89 e5                	mov    %esp,%ebp
  801b9e:	83 ec 18             	sub    $0x18,%esp
	int r;
	if ((r = fd2sockid(s)) < 0)
  801ba1:	8b 45 08             	mov    0x8(%ebp),%eax
  801ba4:	e8 28 ff ff ff       	call   801ad1 <fd2sockid>
  801ba9:	85 c0                	test   %eax,%eax
  801bab:	78 1f                	js     801bcc <accept+0x31>
		return r;
	if ((r = nsipc_accept(r, addr, addrlen)) < 0)
  801bad:	8b 55 10             	mov    0x10(%ebp),%edx
  801bb0:	89 54 24 08          	mov    %edx,0x8(%esp)
  801bb4:	8b 55 0c             	mov    0xc(%ebp),%edx
  801bb7:	89 54 24 04          	mov    %edx,0x4(%esp)
  801bbb:	89 04 24             	mov    %eax,(%esp)
  801bbe:	e8 5b 02 00 00       	call   801e1e <nsipc_accept>
  801bc3:	85 c0                	test   %eax,%eax
  801bc5:	78 05                	js     801bcc <accept+0x31>
		return r;
	return alloc_sockfd(r);
  801bc7:	e8 62 fe ff ff       	call   801a2e <alloc_sockfd>
}
  801bcc:	c9                   	leave  
  801bcd:	8d 76 00             	lea    0x0(%esi),%esi
  801bd0:	c3                   	ret    
	...

00801be0 <nsipc>:
// may be written back to nsipcbuf.
// type: request code, passed as the simple integer IPC value.
// Returns 0 if successful, < 0 on failure.
static int
nsipc(unsigned type)
{
  801be0:	55                   	push   %ebp
  801be1:	89 e5                	mov    %esp,%ebp
  801be3:	83 ec 28             	sub    $0x28,%esp
    int r=0;
    envid_t from;
	if (debug)
		cprintf("[%08x] nsipc %d\n", env->env_id, type);

	ipc_send(envs[2].env_id, type, &nsipcbuf, PTE_P|PTE_W|PTE_U);
  801be6:	8b 15 44 01 c0 ee    	mov    0xeec00144,%edx
  801bec:	c7 44 24 0c 07 00 00 	movl   $0x7,0xc(%esp)
  801bf3:	00 
  801bf4:	c7 44 24 08 00 50 80 	movl   $0x805000,0x8(%esp)
  801bfb:	00 
  801bfc:	89 44 24 04          	mov    %eax,0x4(%esp)
  801c00:	89 14 24             	mov    %edx,(%esp)
  801c03:	e8 78 08 00 00       	call   802480 <ipc_send>
	r=ipc_recv(&from, NULL, NULL);
  801c08:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
  801c0f:	00 
  801c10:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
  801c17:	00 
  801c18:	8d 45 f4             	lea    -0xc(%ebp),%eax
  801c1b:	89 04 24             	mov    %eax,(%esp)
  801c1e:	e8 cf 08 00 00       	call   8024f2 <ipc_recv>
    return r;
}
  801c23:	c9                   	leave  
  801c24:	c3                   	ret    

00801c25 <nsipc_socket>:
	return nsipc(NSREQ_SEND);
}

int
nsipc_socket(int domain, int type, int protocol)
{
  801c25:	55                   	push   %ebp
  801c26:	89 e5                	mov    %esp,%ebp
  801c28:	83 ec 08             	sub    $0x8,%esp
	nsipcbuf.socket.req_domain = domain;
  801c2b:	8b 45 08             	mov    0x8(%ebp),%eax
  801c2e:	a3 00 50 80 00       	mov    %eax,0x805000
	nsipcbuf.socket.req_type = type;
  801c33:	8b 45 0c             	mov    0xc(%ebp),%eax
  801c36:	a3 04 50 80 00       	mov    %eax,0x805004
	nsipcbuf.socket.req_protocol = protocol;
  801c3b:	8b 45 10             	mov    0x10(%ebp),%eax
  801c3e:	a3 08 50 80 00       	mov    %eax,0x805008
	return nsipc(NSREQ_SOCKET);
  801c43:	b8 09 00 00 00       	mov    $0x9,%eax
  801c48:	e8 93 ff ff ff       	call   801be0 <nsipc>
}
  801c4d:	c9                   	leave  
  801c4e:	c3                   	ret    

00801c4f <nsipc_listen>:
	return nsipc(NSREQ_CONNECT);
}

int
nsipc_listen(int s, int backlog)
{
  801c4f:	55                   	push   %ebp
  801c50:	89 e5                	mov    %esp,%ebp
  801c52:	83 ec 08             	sub    $0x8,%esp
	nsipcbuf.listen.req_s = s;
  801c55:	8b 45 08             	mov    0x8(%ebp),%eax
  801c58:	a3 00 50 80 00       	mov    %eax,0x805000
	nsipcbuf.listen.req_backlog = backlog;
  801c5d:	8b 45 0c             	mov    0xc(%ebp),%eax
  801c60:	a3 04 50 80 00       	mov    %eax,0x805004
	return nsipc(NSREQ_LISTEN);
  801c65:	b8 06 00 00 00       	mov    $0x6,%eax
  801c6a:	e8 71 ff ff ff       	call   801be0 <nsipc>
}
  801c6f:	c9                   	leave  
  801c70:	c3                   	ret    

00801c71 <nsipc_close>:
	return nsipc(NSREQ_SHUTDOWN);
}

int
nsipc_close(int s)
{
  801c71:	55                   	push   %ebp
  801c72:	89 e5                	mov    %esp,%ebp
  801c74:	83 ec 08             	sub    $0x8,%esp
	nsipcbuf.close.req_s = s;
  801c77:	8b 45 08             	mov    0x8(%ebp),%eax
  801c7a:	a3 00 50 80 00       	mov    %eax,0x805000
	return nsipc(NSREQ_CLOSE);
  801c7f:	b8 04 00 00 00       	mov    $0x4,%eax
  801c84:	e8 57 ff ff ff       	call   801be0 <nsipc>
}
  801c89:	c9                   	leave  
  801c8a:	c3                   	ret    

00801c8b <nsipc_shutdown>:
	return nsipc(NSREQ_BIND);
}

int
nsipc_shutdown(int s, int how)
{
  801c8b:	55                   	push   %ebp
  801c8c:	89 e5                	mov    %esp,%ebp
  801c8e:	83 ec 08             	sub    $0x8,%esp
	nsipcbuf.shutdown.req_s = s;
  801c91:	8b 45 08             	mov    0x8(%ebp),%eax
  801c94:	a3 00 50 80 00       	mov    %eax,0x805000
	nsipcbuf.shutdown.req_how = how;
  801c99:	8b 45 0c             	mov    0xc(%ebp),%eax
  801c9c:	a3 04 50 80 00       	mov    %eax,0x805004
	return nsipc(NSREQ_SHUTDOWN);
  801ca1:	b8 03 00 00 00       	mov    $0x3,%eax
  801ca6:	e8 35 ff ff ff       	call   801be0 <nsipc>
}
  801cab:	c9                   	leave  
  801cac:	c3                   	ret    

00801cad <nsipc_send>:
	return r;
}

int
nsipc_send(int s, const void *buf, int size, unsigned int flags)
{
  801cad:	55                   	push   %ebp
  801cae:	89 e5                	mov    %esp,%ebp
  801cb0:	53                   	push   %ebx
  801cb1:	83 ec 14             	sub    $0x14,%esp
  801cb4:	8b 5d 10             	mov    0x10(%ebp),%ebx
	nsipcbuf.send.req_s = s;
  801cb7:	8b 45 08             	mov    0x8(%ebp),%eax
  801cba:	a3 00 50 80 00       	mov    %eax,0x805000
	assert(size < 1600);
  801cbf:	81 fb 3f 06 00 00    	cmp    $0x63f,%ebx
  801cc5:	7e 24                	jle    801ceb <nsipc_send+0x3e>
  801cc7:	c7 44 24 0c 14 2c 80 	movl   $0x802c14,0xc(%esp)
  801cce:	00 
  801ccf:	c7 44 24 08 20 2c 80 	movl   $0x802c20,0x8(%esp)
  801cd6:	00 
  801cd7:	c7 44 24 04 69 00 00 	movl   $0x69,0x4(%esp)
  801cde:	00 
  801cdf:	c7 04 24 35 2c 80 00 	movl   $0x802c35,(%esp)
  801ce6:	e8 29 07 00 00       	call   802414 <_panic>
	memmove(&nsipcbuf.send.req_buf, buf, size);
  801ceb:	89 5c 24 08          	mov    %ebx,0x8(%esp)
  801cef:	8b 45 0c             	mov    0xc(%ebp),%eax
  801cf2:	89 44 24 04          	mov    %eax,0x4(%esp)
  801cf6:	c7 04 24 0c 50 80 00 	movl   $0x80500c,(%esp)
  801cfd:	e8 b3 ec ff ff       	call   8009b5 <memmove>
	nsipcbuf.send.req_size = size;
  801d02:	89 1d 04 50 80 00    	mov    %ebx,0x805004
	nsipcbuf.send.req_flags = flags;
  801d08:	8b 45 14             	mov    0x14(%ebp),%eax
  801d0b:	a3 08 50 80 00       	mov    %eax,0x805008
	return nsipc(NSREQ_SEND);
  801d10:	b8 08 00 00 00       	mov    $0x8,%eax
  801d15:	e8 c6 fe ff ff       	call   801be0 <nsipc>
}
  801d1a:	83 c4 14             	add    $0x14,%esp
  801d1d:	5b                   	pop    %ebx
  801d1e:	5d                   	pop    %ebp
  801d1f:	c3                   	ret    

00801d20 <nsipc_recv>:
	return nsipc(NSREQ_LISTEN);
}

int
nsipc_recv(int s, void *mem, int len, unsigned int flags)
{
  801d20:	55                   	push   %ebp
  801d21:	89 e5                	mov    %esp,%ebp
  801d23:	56                   	push   %esi
  801d24:	53                   	push   %ebx
  801d25:	83 ec 10             	sub    $0x10,%esp
  801d28:	8b 75 10             	mov    0x10(%ebp),%esi
	int r;

	nsipcbuf.recv.req_s = s;
  801d2b:	8b 45 08             	mov    0x8(%ebp),%eax
  801d2e:	a3 00 50 80 00       	mov    %eax,0x805000
	nsipcbuf.recv.req_len = len;
  801d33:	89 35 04 50 80 00    	mov    %esi,0x805004
	nsipcbuf.recv.req_flags = flags;
  801d39:	8b 45 14             	mov    0x14(%ebp),%eax
  801d3c:	a3 08 50 80 00       	mov    %eax,0x805008

	if ((r = nsipc(NSREQ_RECV)) >= 0) {
  801d41:	b8 07 00 00 00       	mov    $0x7,%eax
  801d46:	e8 95 fe ff ff       	call   801be0 <nsipc>
  801d4b:	89 c3                	mov    %eax,%ebx
  801d4d:	85 c0                	test   %eax,%eax
  801d4f:	78 46                	js     801d97 <nsipc_recv+0x77>
		assert(r < 1600 && r <= len);
  801d51:	3d 3f 06 00 00       	cmp    $0x63f,%eax
  801d56:	7f 04                	jg     801d5c <nsipc_recv+0x3c>
  801d58:	39 c6                	cmp    %eax,%esi
  801d5a:	7d 24                	jge    801d80 <nsipc_recv+0x60>
  801d5c:	c7 44 24 0c 41 2c 80 	movl   $0x802c41,0xc(%esp)
  801d63:	00 
  801d64:	c7 44 24 08 20 2c 80 	movl   $0x802c20,0x8(%esp)
  801d6b:	00 
  801d6c:	c7 44 24 04 5e 00 00 	movl   $0x5e,0x4(%esp)
  801d73:	00 
  801d74:	c7 04 24 35 2c 80 00 	movl   $0x802c35,(%esp)
  801d7b:	e8 94 06 00 00       	call   802414 <_panic>
		memmove(mem, nsipcbuf.recvRet.ret_buf, r);
  801d80:	89 44 24 08          	mov    %eax,0x8(%esp)
  801d84:	c7 44 24 04 00 50 80 	movl   $0x805000,0x4(%esp)
  801d8b:	00 
  801d8c:	8b 45 0c             	mov    0xc(%ebp),%eax
  801d8f:	89 04 24             	mov    %eax,(%esp)
  801d92:	e8 1e ec ff ff       	call   8009b5 <memmove>
	}

	return r;
}
  801d97:	89 d8                	mov    %ebx,%eax
  801d99:	83 c4 10             	add    $0x10,%esp
  801d9c:	5b                   	pop    %ebx
  801d9d:	5e                   	pop    %esi
  801d9e:	5d                   	pop    %ebp
  801d9f:	c3                   	ret    

00801da0 <nsipc_connect>:
	return nsipc(NSREQ_CLOSE);
}

int
nsipc_connect(int s, const struct sockaddr *name, socklen_t namelen)
{
  801da0:	55                   	push   %ebp
  801da1:	89 e5                	mov    %esp,%ebp
  801da3:	53                   	push   %ebx
  801da4:	83 ec 14             	sub    $0x14,%esp
  801da7:	8b 5d 10             	mov    0x10(%ebp),%ebx
	nsipcbuf.connect.req_s = s;
  801daa:	8b 45 08             	mov    0x8(%ebp),%eax
  801dad:	a3 00 50 80 00       	mov    %eax,0x805000
	memmove(&nsipcbuf.connect.req_name, name, namelen);
  801db2:	89 5c 24 08          	mov    %ebx,0x8(%esp)
  801db6:	8b 45 0c             	mov    0xc(%ebp),%eax
  801db9:	89 44 24 04          	mov    %eax,0x4(%esp)
  801dbd:	c7 04 24 04 50 80 00 	movl   $0x805004,(%esp)
  801dc4:	e8 ec eb ff ff       	call   8009b5 <memmove>
	nsipcbuf.connect.req_namelen = namelen;
  801dc9:	89 1d 14 50 80 00    	mov    %ebx,0x805014
	return nsipc(NSREQ_CONNECT);
  801dcf:	b8 05 00 00 00       	mov    $0x5,%eax
  801dd4:	e8 07 fe ff ff       	call   801be0 <nsipc>
}
  801dd9:	83 c4 14             	add    $0x14,%esp
  801ddc:	5b                   	pop    %ebx
  801ddd:	5d                   	pop    %ebp
  801dde:	c3                   	ret    

00801ddf <nsipc_bind>:
	return r;
}

int
nsipc_bind(int s, struct sockaddr *name, socklen_t namelen)
{
  801ddf:	55                   	push   %ebp
  801de0:	89 e5                	mov    %esp,%ebp
  801de2:	53                   	push   %ebx
  801de3:	83 ec 14             	sub    $0x14,%esp
  801de6:	8b 5d 10             	mov    0x10(%ebp),%ebx
	nsipcbuf.bind.req_s = s;
  801de9:	8b 45 08             	mov    0x8(%ebp),%eax
  801dec:	a3 00 50 80 00       	mov    %eax,0x805000
	memmove(&nsipcbuf.bind.req_name, name, namelen);
  801df1:	89 5c 24 08          	mov    %ebx,0x8(%esp)
  801df5:	8b 45 0c             	mov    0xc(%ebp),%eax
  801df8:	89 44 24 04          	mov    %eax,0x4(%esp)
  801dfc:	c7 04 24 04 50 80 00 	movl   $0x805004,(%esp)
  801e03:	e8 ad eb ff ff       	call   8009b5 <memmove>
	nsipcbuf.bind.req_namelen = namelen;
  801e08:	89 1d 14 50 80 00    	mov    %ebx,0x805014
	return nsipc(NSREQ_BIND);
  801e0e:	b8 02 00 00 00       	mov    $0x2,%eax
  801e13:	e8 c8 fd ff ff       	call   801be0 <nsipc>
}
  801e18:	83 c4 14             	add    $0x14,%esp
  801e1b:	5b                   	pop    %ebx
  801e1c:	5d                   	pop    %ebp
  801e1d:	c3                   	ret    

00801e1e <nsipc_accept>:
    return r;
}

int
nsipc_accept(int s, struct sockaddr *addr, socklen_t *addrlen)
{
  801e1e:	55                   	push   %ebp
  801e1f:	89 e5                	mov    %esp,%ebp
  801e21:	83 ec 18             	sub    $0x18,%esp
  801e24:	89 5d f8             	mov    %ebx,-0x8(%ebp)
  801e27:	89 75 fc             	mov    %esi,-0x4(%ebp)
	int r;
	
	nsipcbuf.accept.req_s = s;
  801e2a:	8b 45 08             	mov    0x8(%ebp),%eax
  801e2d:	a3 00 50 80 00       	mov    %eax,0x805000
	if ((r = nsipc(NSREQ_ACCEPT)) >= 0) {
  801e32:	b8 01 00 00 00       	mov    $0x1,%eax
  801e37:	e8 a4 fd ff ff       	call   801be0 <nsipc>
  801e3c:	89 c3                	mov    %eax,%ebx
  801e3e:	85 c0                	test   %eax,%eax
  801e40:	78 25                	js     801e67 <nsipc_accept+0x49>
		struct Nsret_accept *ret = &nsipcbuf.acceptRet;
		memmove(addr, &ret->ret_addr, ret->ret_addrlen);
  801e42:	be 10 50 80 00       	mov    $0x805010,%esi
  801e47:	8b 06                	mov    (%esi),%eax
  801e49:	89 44 24 08          	mov    %eax,0x8(%esp)
  801e4d:	c7 44 24 04 00 50 80 	movl   $0x805000,0x4(%esp)
  801e54:	00 
  801e55:	8b 45 0c             	mov    0xc(%ebp),%eax
  801e58:	89 04 24             	mov    %eax,(%esp)
  801e5b:	e8 55 eb ff ff       	call   8009b5 <memmove>
		*addrlen = ret->ret_addrlen;
  801e60:	8b 16                	mov    (%esi),%edx
  801e62:	8b 45 10             	mov    0x10(%ebp),%eax
  801e65:	89 10                	mov    %edx,(%eax)
	}
	return r;
}
  801e67:	89 d8                	mov    %ebx,%eax
  801e69:	8b 5d f8             	mov    -0x8(%ebp),%ebx
  801e6c:	8b 75 fc             	mov    -0x4(%ebp),%esi
  801e6f:	89 ec                	mov    %ebp,%esp
  801e71:	5d                   	pop    %ebp
  801e72:	c3                   	ret    
	...

00801e80 <devpipe_stat>:
	return i;
}

static int
devpipe_stat(struct Fd *fd, struct Stat *stat)
{
  801e80:	55                   	push   %ebp
  801e81:	89 e5                	mov    %esp,%ebp
  801e83:	83 ec 18             	sub    $0x18,%esp
  801e86:	89 5d f8             	mov    %ebx,-0x8(%ebp)
  801e89:	89 75 fc             	mov    %esi,-0x4(%ebp)
  801e8c:	8b 75 0c             	mov    0xc(%ebp),%esi
	struct Pipe *p = (struct Pipe*) fd2data(fd);
  801e8f:	8b 45 08             	mov    0x8(%ebp),%eax
  801e92:	89 04 24             	mov    %eax,(%esp)
  801e95:	e8 f6 f1 ff ff       	call   801090 <fd2data>
  801e9a:	89 c3                	mov    %eax,%ebx
	strcpy(stat->st_name, "<pipe>");
  801e9c:	c7 44 24 04 56 2c 80 	movl   $0x802c56,0x4(%esp)
  801ea3:	00 
  801ea4:	89 34 24             	mov    %esi,(%esp)
  801ea7:	e8 4e e9 ff ff       	call   8007fa <strcpy>
	stat->st_size = p->p_wpos - p->p_rpos;
  801eac:	8b 43 04             	mov    0x4(%ebx),%eax
  801eaf:	2b 03                	sub    (%ebx),%eax
  801eb1:	89 86 80 00 00 00    	mov    %eax,0x80(%esi)
	stat->st_isdir = 0;
  801eb7:	c7 86 84 00 00 00 00 	movl   $0x0,0x84(%esi)
  801ebe:	00 00 00 
	stat->st_dev = &devpipe;
  801ec1:	c7 86 88 00 00 00 3c 	movl   $0x80603c,0x88(%esi)
  801ec8:	60 80 00 
	return 0;
}
  801ecb:	b8 00 00 00 00       	mov    $0x0,%eax
  801ed0:	8b 5d f8             	mov    -0x8(%ebp),%ebx
  801ed3:	8b 75 fc             	mov    -0x4(%ebp),%esi
  801ed6:	89 ec                	mov    %ebp,%esp
  801ed8:	5d                   	pop    %ebp
  801ed9:	c3                   	ret    

00801eda <devpipe_close>:

static int
devpipe_close(struct Fd *fd)
{
  801eda:	55                   	push   %ebp
  801edb:	89 e5                	mov    %esp,%ebp
  801edd:	53                   	push   %ebx
  801ede:	83 ec 14             	sub    $0x14,%esp
  801ee1:	8b 5d 08             	mov    0x8(%ebp),%ebx
	(void) sys_page_unmap(0, fd);
  801ee4:	89 5c 24 04          	mov    %ebx,0x4(%esp)
  801ee8:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
  801eef:	e8 a6 ef ff ff       	call   800e9a <sys_page_unmap>
	return sys_page_unmap(0, fd2data(fd));
  801ef4:	89 1c 24             	mov    %ebx,(%esp)
  801ef7:	e8 94 f1 ff ff       	call   801090 <fd2data>
  801efc:	89 44 24 04          	mov    %eax,0x4(%esp)
  801f00:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
  801f07:	e8 8e ef ff ff       	call   800e9a <sys_page_unmap>
}
  801f0c:	83 c4 14             	add    $0x14,%esp
  801f0f:	5b                   	pop    %ebx
  801f10:	5d                   	pop    %ebp
  801f11:	c3                   	ret    

00801f12 <_pipeisclosed>:
	return r;
}

static int
_pipeisclosed(struct Fd *fd, struct Pipe *p)
{
  801f12:	55                   	push   %ebp
  801f13:	89 e5                	mov    %esp,%ebp
  801f15:	57                   	push   %edi
  801f16:	56                   	push   %esi
  801f17:	53                   	push   %ebx
  801f18:	83 ec 2c             	sub    $0x2c,%esp
  801f1b:	89 c7                	mov    %eax,%edi
  801f1d:	89 55 e4             	mov    %edx,-0x1c(%ebp)
	int n, nn, ret;

	while (1) {
		n = env->env_runs;
  801f20:	a1 74 60 80 00       	mov    0x806074,%eax
  801f25:	8b 58 58             	mov    0x58(%eax),%ebx
		ret = pageref(fd) == pageref(p);
  801f28:	89 3c 24             	mov    %edi,(%esp)
  801f2b:	e8 14 06 00 00       	call   802544 <pageref>
  801f30:	89 c6                	mov    %eax,%esi
  801f32:	8b 45 e4             	mov    -0x1c(%ebp),%eax
  801f35:	89 04 24             	mov    %eax,(%esp)
  801f38:	e8 07 06 00 00       	call   802544 <pageref>
  801f3d:	39 c6                	cmp    %eax,%esi
  801f3f:	0f 94 c0             	sete   %al
  801f42:	0f b6 c0             	movzbl %al,%eax
		nn = env->env_runs;
  801f45:	8b 15 74 60 80 00    	mov    0x806074,%edx
  801f4b:	8b 4a 58             	mov    0x58(%edx),%ecx
		if (n == nn)
  801f4e:	39 cb                	cmp    %ecx,%ebx
  801f50:	75 08                	jne    801f5a <_pipeisclosed+0x48>
			return ret;
		if (n != nn && ret == 1)
			cprintf("pipe race avoided\n", n, env->env_runs, ret);
	}
}
  801f52:	83 c4 2c             	add    $0x2c,%esp
  801f55:	5b                   	pop    %ebx
  801f56:	5e                   	pop    %esi
  801f57:	5f                   	pop    %edi
  801f58:	5d                   	pop    %ebp
  801f59:	c3                   	ret    
		n = env->env_runs;
		ret = pageref(fd) == pageref(p);
		nn = env->env_runs;
		if (n == nn)
			return ret;
		if (n != nn && ret == 1)
  801f5a:	83 f8 01             	cmp    $0x1,%eax
  801f5d:	75 c1                	jne    801f20 <_pipeisclosed+0xe>
			cprintf("pipe race avoided\n", n, env->env_runs, ret);
  801f5f:	8b 52 58             	mov    0x58(%edx),%edx
  801f62:	89 44 24 0c          	mov    %eax,0xc(%esp)
  801f66:	89 54 24 08          	mov    %edx,0x8(%esp)
  801f6a:	89 5c 24 04          	mov    %ebx,0x4(%esp)
  801f6e:	c7 04 24 5d 2c 80 00 	movl   $0x802c5d,(%esp)
  801f75:	e8 b3 e1 ff ff       	call   80012d <cprintf>
  801f7a:	eb a4                	jmp    801f20 <_pipeisclosed+0xe>

00801f7c <devpipe_write>:
	return i;
}

static ssize_t
devpipe_write(struct Fd *fd, const void *vbuf, size_t n)
{
  801f7c:	55                   	push   %ebp
  801f7d:	89 e5                	mov    %esp,%ebp
  801f7f:	57                   	push   %edi
  801f80:	56                   	push   %esi
  801f81:	53                   	push   %ebx
  801f82:	83 ec 1c             	sub    $0x1c,%esp
  801f85:	8b 75 08             	mov    0x8(%ebp),%esi
	const uint8_t *buf;
	size_t i;
	struct Pipe *p;

	p = (struct Pipe*) fd2data(fd);
  801f88:	89 34 24             	mov    %esi,(%esp)
  801f8b:	e8 00 f1 ff ff       	call   801090 <fd2data>
  801f90:	89 c3                	mov    %eax,%ebx
	if (debug)
		cprintf("[%08x] devpipe_write %08x %d rpos %d wpos %d\n",
			env->env_id, vpt[VPN(p)], n, p->p_rpos, p->p_wpos);

	buf = vbuf;
	for (i = 0; i < n; i++) {
  801f92:	bf 00 00 00 00       	mov    $0x0,%edi
  801f97:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
  801f9b:	75 54                	jne    801ff1 <devpipe_write+0x75>
  801f9d:	eb 60                	jmp    801fff <devpipe_write+0x83>
		while (p->p_wpos >= p->p_rpos + sizeof(p->p_buf)) {
			// pipe is full
			// if all the readers are gone
			// (it's only writers like us now),
			// note eof
			if (_pipeisclosed(fd, p))
  801f9f:	89 da                	mov    %ebx,%edx
  801fa1:	89 f0                	mov    %esi,%eax
  801fa3:	e8 6a ff ff ff       	call   801f12 <_pipeisclosed>
  801fa8:	85 c0                	test   %eax,%eax
  801faa:	74 07                	je     801fb3 <devpipe_write+0x37>
  801fac:	b8 00 00 00 00       	mov    $0x0,%eax
  801fb1:	eb 53                	jmp    802006 <devpipe_write+0x8a>
				return 0;
			// yield and see what happens
			if (debug)
				cprintf("devpipe_write yield\n");
			sys_yield();
  801fb3:	90                   	nop
  801fb4:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi
  801fb8:	e8 f8 ef ff ff       	call   800fb5 <sys_yield>
		cprintf("[%08x] devpipe_write %08x %d rpos %d wpos %d\n",
			env->env_id, vpt[VPN(p)], n, p->p_rpos, p->p_wpos);

	buf = vbuf;
	for (i = 0; i < n; i++) {
		while (p->p_wpos >= p->p_rpos + sizeof(p->p_buf)) {
  801fbd:	8b 43 04             	mov    0x4(%ebx),%eax
  801fc0:	8b 13                	mov    (%ebx),%edx
  801fc2:	83 c2 20             	add    $0x20,%edx
  801fc5:	39 d0                	cmp    %edx,%eax
  801fc7:	73 d6                	jae    801f9f <devpipe_write+0x23>
				cprintf("devpipe_write yield\n");
			sys_yield();
		}
		// there's room for a byte.  store it.
		// wait to increment wpos until the byte is stored!
		p->p_buf[p->p_wpos % PIPEBUFSIZ] = buf[i];
  801fc9:	89 c2                	mov    %eax,%edx
  801fcb:	c1 fa 1f             	sar    $0x1f,%edx
  801fce:	c1 ea 1b             	shr    $0x1b,%edx
  801fd1:	01 d0                	add    %edx,%eax
  801fd3:	83 e0 1f             	and    $0x1f,%eax
  801fd6:	29 d0                	sub    %edx,%eax
  801fd8:	89 c2                	mov    %eax,%edx
  801fda:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  801fdd:	0f b6 04 39          	movzbl (%ecx,%edi,1),%eax
  801fe1:	88 44 13 08          	mov    %al,0x8(%ebx,%edx,1)
		p->p_wpos++;
  801fe5:	83 43 04 01          	addl   $0x1,0x4(%ebx)
	if (debug)
		cprintf("[%08x] devpipe_write %08x %d rpos %d wpos %d\n",
			env->env_id, vpt[VPN(p)], n, p->p_rpos, p->p_wpos);

	buf = vbuf;
	for (i = 0; i < n; i++) {
  801fe9:	83 c7 01             	add    $0x1,%edi
  801fec:	39 7d 10             	cmp    %edi,0x10(%ebp)
  801fef:	76 13                	jbe    802004 <devpipe_write+0x88>
		while (p->p_wpos >= p->p_rpos + sizeof(p->p_buf)) {
  801ff1:	8b 43 04             	mov    0x4(%ebx),%eax
  801ff4:	8b 13                	mov    (%ebx),%edx
  801ff6:	83 c2 20             	add    $0x20,%edx
  801ff9:	39 d0                	cmp    %edx,%eax
  801ffb:	73 a2                	jae    801f9f <devpipe_write+0x23>
  801ffd:	eb ca                	jmp    801fc9 <devpipe_write+0x4d>
  801fff:	bf 00 00 00 00       	mov    $0x0,%edi
		// wait to increment wpos until the byte is stored!
		p->p_buf[p->p_wpos % PIPEBUFSIZ] = buf[i];
		p->p_wpos++;
	}
	
	return i;
  802004:	89 f8                	mov    %edi,%eax
}
  802006:	83 c4 1c             	add    $0x1c,%esp
  802009:	5b                   	pop    %ebx
  80200a:	5e                   	pop    %esi
  80200b:	5f                   	pop    %edi
  80200c:	5d                   	pop    %ebp
  80200d:	c3                   	ret    

0080200e <devpipe_read>:
	return _pipeisclosed(fd, p);
}

static ssize_t
devpipe_read(struct Fd *fd, void *vbuf, size_t n)
{
  80200e:	55                   	push   %ebp
  80200f:	89 e5                	mov    %esp,%ebp
  802011:	83 ec 28             	sub    $0x28,%esp
  802014:	89 5d f4             	mov    %ebx,-0xc(%ebp)
  802017:	89 75 f8             	mov    %esi,-0x8(%ebp)
  80201a:	89 7d fc             	mov    %edi,-0x4(%ebp)
  80201d:	8b 7d 08             	mov    0x8(%ebp),%edi
	uint8_t *buf;
	size_t i;
	struct Pipe *p;

	p = (struct Pipe*)fd2data(fd);
  802020:	89 3c 24             	mov    %edi,(%esp)
  802023:	e8 68 f0 ff ff       	call   801090 <fd2data>
  802028:	89 c3                	mov    %eax,%ebx
	if (debug)
		cprintf("[%08x] devpipe_read %08x %d rpos %d wpos %d\n",
			env->env_id, vpt[VPN(p)], n, p->p_rpos, p->p_wpos);

	buf = vbuf;
	for (i = 0; i < n; i++) {
  80202a:	be 00 00 00 00       	mov    $0x0,%esi
  80202f:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
  802033:	75 4c                	jne    802081 <devpipe_read+0x73>
  802035:	eb 5b                	jmp    802092 <devpipe_read+0x84>
		while (p->p_rpos == p->p_wpos) {
			// pipe is empty
			// if we got any data, return it
			if (i > 0)
				return i;
  802037:	89 f0                	mov    %esi,%eax
  802039:	eb 5e                	jmp    802099 <devpipe_read+0x8b>
			// if all the writers are gone, note eof
			if (_pipeisclosed(fd, p))
  80203b:	89 da                	mov    %ebx,%edx
  80203d:	89 f8                	mov    %edi,%eax
  80203f:	90                   	nop
  802040:	e8 cd fe ff ff       	call   801f12 <_pipeisclosed>
  802045:	85 c0                	test   %eax,%eax
  802047:	74 07                	je     802050 <devpipe_read+0x42>
  802049:	b8 00 00 00 00       	mov    $0x0,%eax
  80204e:	eb 49                	jmp    802099 <devpipe_read+0x8b>
				return 0;
			// yield and see what happens
			if (debug)
				cprintf("devpipe_read yield\n");
			sys_yield();
  802050:	e8 60 ef ff ff       	call   800fb5 <sys_yield>
		cprintf("[%08x] devpipe_read %08x %d rpos %d wpos %d\n",
			env->env_id, vpt[VPN(p)], n, p->p_rpos, p->p_wpos);

	buf = vbuf;
	for (i = 0; i < n; i++) {
		while (p->p_rpos == p->p_wpos) {
  802055:	8b 03                	mov    (%ebx),%eax
  802057:	3b 43 04             	cmp    0x4(%ebx),%eax
  80205a:	74 df                	je     80203b <devpipe_read+0x2d>
				cprintf("devpipe_read yield\n");
			sys_yield();
		}
		// there's a byte.  take it.
		// wait to increment rpos until the byte is taken!
		buf[i] = p->p_buf[p->p_rpos % PIPEBUFSIZ];
  80205c:	89 c2                	mov    %eax,%edx
  80205e:	c1 fa 1f             	sar    $0x1f,%edx
  802061:	c1 ea 1b             	shr    $0x1b,%edx
  802064:	01 d0                	add    %edx,%eax
  802066:	83 e0 1f             	and    $0x1f,%eax
  802069:	29 d0                	sub    %edx,%eax
  80206b:	0f b6 44 03 08       	movzbl 0x8(%ebx,%eax,1),%eax
  802070:	8b 55 0c             	mov    0xc(%ebp),%edx
  802073:	88 04 32             	mov    %al,(%edx,%esi,1)
		p->p_rpos++;
  802076:	83 03 01             	addl   $0x1,(%ebx)
	if (debug)
		cprintf("[%08x] devpipe_read %08x %d rpos %d wpos %d\n",
			env->env_id, vpt[VPN(p)], n, p->p_rpos, p->p_wpos);

	buf = vbuf;
	for (i = 0; i < n; i++) {
  802079:	83 c6 01             	add    $0x1,%esi
  80207c:	39 75 10             	cmp    %esi,0x10(%ebp)
  80207f:	76 16                	jbe    802097 <devpipe_read+0x89>
		while (p->p_rpos == p->p_wpos) {
  802081:	8b 03                	mov    (%ebx),%eax
  802083:	3b 43 04             	cmp    0x4(%ebx),%eax
  802086:	75 d4                	jne    80205c <devpipe_read+0x4e>
			// pipe is empty
			// if we got any data, return it
			if (i > 0)
  802088:	85 f6                	test   %esi,%esi
  80208a:	75 ab                	jne    802037 <devpipe_read+0x29>
  80208c:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi
  802090:	eb a9                	jmp    80203b <devpipe_read+0x2d>
  802092:	be 00 00 00 00       	mov    $0x0,%esi
		// there's a byte.  take it.
		// wait to increment rpos until the byte is taken!
		buf[i] = p->p_buf[p->p_rpos % PIPEBUFSIZ];
		p->p_rpos++;
	}
	return i;
  802097:	89 f0                	mov    %esi,%eax
}
  802099:	8b 5d f4             	mov    -0xc(%ebp),%ebx
  80209c:	8b 75 f8             	mov    -0x8(%ebp),%esi
  80209f:	8b 7d fc             	mov    -0x4(%ebp),%edi
  8020a2:	89 ec                	mov    %ebp,%esp
  8020a4:	5d                   	pop    %ebp
  8020a5:	c3                   	ret    

008020a6 <pipeisclosed>:
	}
}

int
pipeisclosed(int fdnum)
{
  8020a6:	55                   	push   %ebp
  8020a7:	89 e5                	mov    %esp,%ebp
  8020a9:	83 ec 28             	sub    $0x28,%esp
	struct Fd *fd;
	struct Pipe *p;
	int r;

	if ((r = fd_lookup(fdnum, &fd)) < 0)
  8020ac:	8d 45 f4             	lea    -0xc(%ebp),%eax
  8020af:	89 44 24 04          	mov    %eax,0x4(%esp)
  8020b3:	8b 45 08             	mov    0x8(%ebp),%eax
  8020b6:	89 04 24             	mov    %eax,(%esp)
  8020b9:	e8 5f f0 ff ff       	call   80111d <fd_lookup>
  8020be:	85 c0                	test   %eax,%eax
  8020c0:	78 15                	js     8020d7 <pipeisclosed+0x31>
		return r;
	p = (struct Pipe*) fd2data(fd);
  8020c2:	8b 45 f4             	mov    -0xc(%ebp),%eax
  8020c5:	89 04 24             	mov    %eax,(%esp)
  8020c8:	e8 c3 ef ff ff       	call   801090 <fd2data>
	return _pipeisclosed(fd, p);
  8020cd:	89 c2                	mov    %eax,%edx
  8020cf:	8b 45 f4             	mov    -0xc(%ebp),%eax
  8020d2:	e8 3b fe ff ff       	call   801f12 <_pipeisclosed>
}
  8020d7:	c9                   	leave  
  8020d8:	c3                   	ret    

008020d9 <pipe>:
	uint8_t p_buf[PIPEBUFSIZ];	// data buffer
};

int
pipe(int pfd[2])
{
  8020d9:	55                   	push   %ebp
  8020da:	89 e5                	mov    %esp,%ebp
  8020dc:	83 ec 48             	sub    $0x48,%esp
  8020df:	89 5d f4             	mov    %ebx,-0xc(%ebp)
  8020e2:	89 75 f8             	mov    %esi,-0x8(%ebp)
  8020e5:	89 7d fc             	mov    %edi,-0x4(%ebp)
  8020e8:	8b 7d 08             	mov    0x8(%ebp),%edi
	int r;
	struct Fd *fd0, *fd1;
	void *va;

	// allocate the file descriptor table entries
	if ((r = fd_alloc(&fd0)) < 0
  8020eb:	8d 45 e4             	lea    -0x1c(%ebp),%eax
  8020ee:	89 04 24             	mov    %eax,(%esp)
  8020f1:	e8 b5 ef ff ff       	call   8010ab <fd_alloc>
  8020f6:	89 c3                	mov    %eax,%ebx
  8020f8:	85 c0                	test   %eax,%eax
  8020fa:	0f 88 42 01 00 00    	js     802242 <pipe+0x169>
	    || (r = sys_page_alloc(0, fd0, PTE_P|PTE_W|PTE_U|PTE_SHARE)) < 0)
  802100:	c7 44 24 08 07 04 00 	movl   $0x407,0x8(%esp)
  802107:	00 
  802108:	8b 45 e4             	mov    -0x1c(%ebp),%eax
  80210b:	89 44 24 04          	mov    %eax,0x4(%esp)
  80210f:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
  802116:	e8 3b ee ff ff       	call   800f56 <sys_page_alloc>
  80211b:	89 c3                	mov    %eax,%ebx
	int r;
	struct Fd *fd0, *fd1;
	void *va;

	// allocate the file descriptor table entries
	if ((r = fd_alloc(&fd0)) < 0
  80211d:	85 c0                	test   %eax,%eax
  80211f:	0f 88 1d 01 00 00    	js     802242 <pipe+0x169>
	    || (r = sys_page_alloc(0, fd0, PTE_P|PTE_W|PTE_U|PTE_SHARE)) < 0)
		goto err;

	if ((r = fd_alloc(&fd1)) < 0
  802125:	8d 45 e0             	lea    -0x20(%ebp),%eax
  802128:	89 04 24             	mov    %eax,(%esp)
  80212b:	e8 7b ef ff ff       	call   8010ab <fd_alloc>
  802130:	89 c3                	mov    %eax,%ebx
  802132:	85 c0                	test   %eax,%eax
  802134:	0f 88 f5 00 00 00    	js     80222f <pipe+0x156>
	    || (r = sys_page_alloc(0, fd1, PTE_P|PTE_W|PTE_U|PTE_SHARE)) < 0)
  80213a:	c7 44 24 08 07 04 00 	movl   $0x407,0x8(%esp)
  802141:	00 
  802142:	8b 45 e0             	mov    -0x20(%ebp),%eax
  802145:	89 44 24 04          	mov    %eax,0x4(%esp)
  802149:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
  802150:	e8 01 ee ff ff       	call   800f56 <sys_page_alloc>
  802155:	89 c3                	mov    %eax,%ebx
	// allocate the file descriptor table entries
	if ((r = fd_alloc(&fd0)) < 0
	    || (r = sys_page_alloc(0, fd0, PTE_P|PTE_W|PTE_U|PTE_SHARE)) < 0)
		goto err;

	if ((r = fd_alloc(&fd1)) < 0
  802157:	85 c0                	test   %eax,%eax
  802159:	0f 88 d0 00 00 00    	js     80222f <pipe+0x156>
	    || (r = sys_page_alloc(0, fd1, PTE_P|PTE_W|PTE_U|PTE_SHARE)) < 0)
		goto err1;

	// allocate the pipe structure as first data page in both
	va = fd2data(fd0);
  80215f:	8b 45 e4             	mov    -0x1c(%ebp),%eax
  802162:	89 04 24             	mov    %eax,(%esp)
  802165:	e8 26 ef ff ff       	call   801090 <fd2data>
  80216a:	89 c6                	mov    %eax,%esi
	if ((r = sys_page_alloc(0, va, PTE_P|PTE_W|PTE_U|PTE_SHARE)) < 0)
  80216c:	c7 44 24 08 07 04 00 	movl   $0x407,0x8(%esp)
  802173:	00 
  802174:	89 44 24 04          	mov    %eax,0x4(%esp)
  802178:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
  80217f:	e8 d2 ed ff ff       	call   800f56 <sys_page_alloc>
  802184:	89 c3                	mov    %eax,%ebx
  802186:	85 c0                	test   %eax,%eax
  802188:	0f 88 8e 00 00 00    	js     80221c <pipe+0x143>
		goto err2;
	if ((r = sys_page_map(0, va, 0, fd2data(fd1), PTE_P|PTE_W|PTE_U|PTE_SHARE)) < 0)
  80218e:	8b 45 e0             	mov    -0x20(%ebp),%eax
  802191:	89 04 24             	mov    %eax,(%esp)
  802194:	e8 f7 ee ff ff       	call   801090 <fd2data>
  802199:	c7 44 24 10 07 04 00 	movl   $0x407,0x10(%esp)
  8021a0:	00 
  8021a1:	89 44 24 0c          	mov    %eax,0xc(%esp)
  8021a5:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
  8021ac:	00 
  8021ad:	89 74 24 04          	mov    %esi,0x4(%esp)
  8021b1:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
  8021b8:	e8 3b ed ff ff       	call   800ef8 <sys_page_map>
  8021bd:	89 c3                	mov    %eax,%ebx
  8021bf:	85 c0                	test   %eax,%eax
  8021c1:	78 49                	js     80220c <pipe+0x133>
		goto err3;

	// set up fd structures
	fd0->fd_dev_id = devpipe.dev_id;
  8021c3:	b8 3c 60 80 00       	mov    $0x80603c,%eax
  8021c8:	8b 08                	mov    (%eax),%ecx
  8021ca:	8b 55 e4             	mov    -0x1c(%ebp),%edx
  8021cd:	89 0a                	mov    %ecx,(%edx)
	fd0->fd_omode = O_RDONLY;
  8021cf:	8b 55 e4             	mov    -0x1c(%ebp),%edx
  8021d2:	c7 42 08 00 00 00 00 	movl   $0x0,0x8(%edx)

	fd1->fd_dev_id = devpipe.dev_id;
  8021d9:	8b 10                	mov    (%eax),%edx
  8021db:	8b 45 e0             	mov    -0x20(%ebp),%eax
  8021de:	89 10                	mov    %edx,(%eax)
	fd1->fd_omode = O_WRONLY;
  8021e0:	8b 45 e0             	mov    -0x20(%ebp),%eax
  8021e3:	c7 40 08 01 00 00 00 	movl   $0x1,0x8(%eax)

	if (debug)
		cprintf("[%08x] pipecreate %08x\n", env->env_id, vpt[VPN(va)]);

	pfd[0] = fd2num(fd0);
  8021ea:	8b 45 e4             	mov    -0x1c(%ebp),%eax
  8021ed:	89 04 24             	mov    %eax,(%esp)
  8021f0:	e8 8b ee ff ff       	call   801080 <fd2num>
  8021f5:	89 07                	mov    %eax,(%edi)
	pfd[1] = fd2num(fd1);
  8021f7:	8b 45 e0             	mov    -0x20(%ebp),%eax
  8021fa:	89 04 24             	mov    %eax,(%esp)
  8021fd:	e8 7e ee ff ff       	call   801080 <fd2num>
  802202:	89 47 04             	mov    %eax,0x4(%edi)
  802205:	bb 00 00 00 00       	mov    $0x0,%ebx
	return 0;
  80220a:	eb 36                	jmp    802242 <pipe+0x169>

    err3:
	sys_page_unmap(0, va);
  80220c:	89 74 24 04          	mov    %esi,0x4(%esp)
  802210:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
  802217:	e8 7e ec ff ff       	call   800e9a <sys_page_unmap>
    err2:
	sys_page_unmap(0, fd1);
  80221c:	8b 45 e0             	mov    -0x20(%ebp),%eax
  80221f:	89 44 24 04          	mov    %eax,0x4(%esp)
  802223:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
  80222a:	e8 6b ec ff ff       	call   800e9a <sys_page_unmap>
    err1:
	sys_page_unmap(0, fd0);
  80222f:	8b 45 e4             	mov    -0x1c(%ebp),%eax
  802232:	89 44 24 04          	mov    %eax,0x4(%esp)
  802236:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
  80223d:	e8 58 ec ff ff       	call   800e9a <sys_page_unmap>
    err:
	return r;
}
  802242:	89 d8                	mov    %ebx,%eax
  802244:	8b 5d f4             	mov    -0xc(%ebp),%ebx
  802247:	8b 75 f8             	mov    -0x8(%ebp),%esi
  80224a:	8b 7d fc             	mov    -0x4(%ebp),%edi
  80224d:	89 ec                	mov    %ebp,%esp
  80224f:	5d                   	pop    %ebp
  802250:	c3                   	ret    
	...

00802260 <devcons_close>:
	return tot;
}

static int
devcons_close(struct Fd *fd)
{
  802260:	55                   	push   %ebp
  802261:	89 e5                	mov    %esp,%ebp
	USED(fd);

	return 0;
}
  802263:	b8 00 00 00 00       	mov    $0x0,%eax
  802268:	5d                   	pop    %ebp
  802269:	c3                   	ret    

0080226a <devcons_stat>:

static int
devcons_stat(struct Fd *fd, struct Stat *stat)
{
  80226a:	55                   	push   %ebp
  80226b:	89 e5                	mov    %esp,%ebp
  80226d:	83 ec 18             	sub    $0x18,%esp
	strcpy(stat->st_name, "<cons>");
  802270:	c7 44 24 04 75 2c 80 	movl   $0x802c75,0x4(%esp)
  802277:	00 
  802278:	8b 45 0c             	mov    0xc(%ebp),%eax
  80227b:	89 04 24             	mov    %eax,(%esp)
  80227e:	e8 77 e5 ff ff       	call   8007fa <strcpy>
	return 0;
}
  802283:	b8 00 00 00 00       	mov    $0x0,%eax
  802288:	c9                   	leave  
  802289:	c3                   	ret    

0080228a <devcons_write>:
	return 1;
}

static ssize_t
devcons_write(struct Fd *fd, const void *vbuf, size_t n)
{
  80228a:	55                   	push   %ebp
  80228b:	89 e5                	mov    %esp,%ebp
  80228d:	57                   	push   %edi
  80228e:	56                   	push   %esi
  80228f:	53                   	push   %ebx
  802290:	81 ec 9c 00 00 00    	sub    $0x9c,%esp
	int tot, m;
	char buf[128];

	// mistake: have to nul-terminate arg to sys_cputs, 
	// so we have to copy vbuf into buf in chunks and nul-terminate.
	for (tot = 0; tot < n; tot += m) {
  802296:	b8 00 00 00 00       	mov    $0x0,%eax
  80229b:	be 00 00 00 00       	mov    $0x0,%esi
  8022a0:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
  8022a4:	74 41                	je     8022e7 <devcons_write+0x5d>
		m = n - tot;
		if (m > sizeof(buf) - 1)
			m = sizeof(buf) - 1;
		memmove(buf, (char*)vbuf + tot, m);
  8022a6:	8d bd 68 ff ff ff    	lea    -0x98(%ebp),%edi
	char buf[128];

	// mistake: have to nul-terminate arg to sys_cputs, 
	// so we have to copy vbuf into buf in chunks and nul-terminate.
	for (tot = 0; tot < n; tot += m) {
		m = n - tot;
  8022ac:	8b 5d 10             	mov    0x10(%ebp),%ebx
  8022af:	29 c3                	sub    %eax,%ebx
		if (m > sizeof(buf) - 1)
  8022b1:	81 fb 80 00 00 00    	cmp    $0x80,%ebx
  8022b7:	ba 7f 00 00 00       	mov    $0x7f,%edx
  8022bc:	0f 43 da             	cmovae %edx,%ebx
			m = sizeof(buf) - 1;
		memmove(buf, (char*)vbuf + tot, m);
  8022bf:	89 5c 24 08          	mov    %ebx,0x8(%esp)
  8022c3:	03 45 0c             	add    0xc(%ebp),%eax
  8022c6:	89 44 24 04          	mov    %eax,0x4(%esp)
  8022ca:	89 3c 24             	mov    %edi,(%esp)
  8022cd:	e8 e3 e6 ff ff       	call   8009b5 <memmove>
		sys_cputs(buf, m);
  8022d2:	89 5c 24 04          	mov    %ebx,0x4(%esp)
  8022d6:	89 3c 24             	mov    %edi,(%esp)
  8022d9:	e8 12 e9 ff ff       	call   800bf0 <sys_cputs>
	int tot, m;
	char buf[128];

	// mistake: have to nul-terminate arg to sys_cputs, 
	// so we have to copy vbuf into buf in chunks and nul-terminate.
	for (tot = 0; tot < n; tot += m) {
  8022de:	01 de                	add    %ebx,%esi
  8022e0:	89 f0                	mov    %esi,%eax
  8022e2:	3b 75 10             	cmp    0x10(%ebp),%esi
  8022e5:	72 c5                	jb     8022ac <devcons_write+0x22>
			m = sizeof(buf) - 1;
		memmove(buf, (char*)vbuf + tot, m);
		sys_cputs(buf, m);
	}
	return tot;
}
  8022e7:	89 f0                	mov    %esi,%eax
  8022e9:	81 c4 9c 00 00 00    	add    $0x9c,%esp
  8022ef:	5b                   	pop    %ebx
  8022f0:	5e                   	pop    %esi
  8022f1:	5f                   	pop    %edi
  8022f2:	5d                   	pop    %ebp
  8022f3:	c3                   	ret    

008022f4 <cputchar>:
#include <inc/string.h>
#include <inc/lib.h>

void
cputchar(int ch)
{
  8022f4:	55                   	push   %ebp
  8022f5:	89 e5                	mov    %esp,%ebp
  8022f7:	83 ec 28             	sub    $0x28,%esp
	char c = ch;
  8022fa:	8b 45 08             	mov    0x8(%ebp),%eax
  8022fd:	88 45 f7             	mov    %al,-0x9(%ebp)

	// Unlike standard Unix's putchar,
	// the cputchar function _always_ outputs to the system console.
	sys_cputs(&c, 1);
  802300:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
  802307:	00 
  802308:	8d 45 f7             	lea    -0x9(%ebp),%eax
  80230b:	89 04 24             	mov    %eax,(%esp)
  80230e:	e8 dd e8 ff ff       	call   800bf0 <sys_cputs>
}
  802313:	c9                   	leave  
  802314:	c3                   	ret    

00802315 <devcons_read>:
	return fd2num(fd);
}

static ssize_t
devcons_read(struct Fd *fd, void *vbuf, size_t n)
{
  802315:	55                   	push   %ebp
  802316:	89 e5                	mov    %esp,%ebp
  802318:	83 ec 08             	sub    $0x8,%esp
	int c;

	if (n == 0)
  80231b:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
  80231f:	75 07                	jne    802328 <devcons_read+0x13>
  802321:	eb 2d                	jmp    802350 <devcons_read+0x3b>
		return 0;
	while ((c = sys_cgetc()) == 0)
		sys_yield();
  802323:	e8 8d ec ff ff       	call   800fb5 <sys_yield>
{
	int c;

	if (n == 0)
		return 0;
	while ((c = sys_cgetc()) == 0)
  802328:	90                   	nop
  802329:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
  802330:	e8 87 e8 ff ff       	call   800bbc <sys_cgetc>
  802335:	85 c0                	test   %eax,%eax
  802337:	74 ea                	je     802323 <devcons_read+0xe>
  802339:	89 c2                	mov    %eax,%edx
		sys_yield();
	if (c < 0)
  80233b:	85 c0                	test   %eax,%eax
  80233d:	78 16                	js     802355 <devcons_read+0x40>
		return c;
	if (c == 0x04)	// ctl-d is eof
  80233f:	83 f8 04             	cmp    $0x4,%eax
  802342:	74 0c                	je     802350 <devcons_read+0x3b>
		return 0;
	*(char*)vbuf = c;
  802344:	8b 45 0c             	mov    0xc(%ebp),%eax
  802347:	88 10                	mov    %dl,(%eax)
  802349:	b8 01 00 00 00       	mov    $0x1,%eax
	return 1;
  80234e:	eb 05                	jmp    802355 <devcons_read+0x40>
  802350:	b8 00 00 00 00       	mov    $0x0,%eax
}
  802355:	c9                   	leave  
  802356:	c3                   	ret    

00802357 <opencons>:
	return fd->fd_dev_id == devcons.dev_id;
}

int
opencons(void)
{
  802357:	55                   	push   %ebp
  802358:	89 e5                	mov    %esp,%ebp
  80235a:	83 ec 28             	sub    $0x28,%esp
	int r;
	struct Fd* fd;

	if ((r = fd_alloc(&fd)) < 0)
  80235d:	8d 45 f4             	lea    -0xc(%ebp),%eax
  802360:	89 04 24             	mov    %eax,(%esp)
  802363:	e8 43 ed ff ff       	call   8010ab <fd_alloc>
  802368:	85 c0                	test   %eax,%eax
  80236a:	78 3f                	js     8023ab <opencons+0x54>
		return r;
	if ((r = sys_page_alloc(0, fd, PTE_P|PTE_U|PTE_W|PTE_SHARE)) < 0)
  80236c:	c7 44 24 08 07 04 00 	movl   $0x407,0x8(%esp)
  802373:	00 
  802374:	8b 45 f4             	mov    -0xc(%ebp),%eax
  802377:	89 44 24 04          	mov    %eax,0x4(%esp)
  80237b:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
  802382:	e8 cf eb ff ff       	call   800f56 <sys_page_alloc>
  802387:	85 c0                	test   %eax,%eax
  802389:	78 20                	js     8023ab <opencons+0x54>
		return r;
	fd->fd_dev_id = devcons.dev_id;
  80238b:	8b 15 58 60 80 00    	mov    0x806058,%edx
  802391:	8b 45 f4             	mov    -0xc(%ebp),%eax
  802394:	89 10                	mov    %edx,(%eax)
	fd->fd_omode = O_RDWR;
  802396:	8b 45 f4             	mov    -0xc(%ebp),%eax
  802399:	c7 40 08 02 00 00 00 	movl   $0x2,0x8(%eax)
	return fd2num(fd);
  8023a0:	8b 45 f4             	mov    -0xc(%ebp),%eax
  8023a3:	89 04 24             	mov    %eax,(%esp)
  8023a6:	e8 d5 ec ff ff       	call   801080 <fd2num>
}
  8023ab:	c9                   	leave  
  8023ac:	c3                   	ret    

008023ad <iscons>:
	.dev_stat =	devcons_stat
};

int
iscons(int fdnum)
{
  8023ad:	55                   	push   %ebp
  8023ae:	89 e5                	mov    %esp,%ebp
  8023b0:	83 ec 28             	sub    $0x28,%esp
	int r;
	struct Fd *fd;

	if ((r = fd_lookup(fdnum, &fd)) < 0)
  8023b3:	8d 45 f4             	lea    -0xc(%ebp),%eax
  8023b6:	89 44 24 04          	mov    %eax,0x4(%esp)
  8023ba:	8b 45 08             	mov    0x8(%ebp),%eax
  8023bd:	89 04 24             	mov    %eax,(%esp)
  8023c0:	e8 58 ed ff ff       	call   80111d <fd_lookup>
  8023c5:	85 c0                	test   %eax,%eax
  8023c7:	78 11                	js     8023da <iscons+0x2d>
		return r;
	return fd->fd_dev_id == devcons.dev_id;
  8023c9:	8b 45 f4             	mov    -0xc(%ebp),%eax
  8023cc:	8b 00                	mov    (%eax),%eax
  8023ce:	3b 05 58 60 80 00    	cmp    0x806058,%eax
  8023d4:	0f 94 c0             	sete   %al
  8023d7:	0f b6 c0             	movzbl %al,%eax
}
  8023da:	c9                   	leave  
  8023db:	c3                   	ret    

008023dc <getchar>:
	sys_cputs(&c, 1);
}

int
getchar(void)
{
  8023dc:	55                   	push   %ebp
  8023dd:	89 e5                	mov    %esp,%ebp
  8023df:	83 ec 28             	sub    $0x28,%esp
	int r;

	// JOS does, however, support standard _input_ redirection,
	// allowing the user to redirect script files to the shell and such.
	// getchar() reads a character from file descriptor 0.
	r = read(0, &c, 1);
  8023e2:	c7 44 24 08 01 00 00 	movl   $0x1,0x8(%esp)
  8023e9:	00 
  8023ea:	8d 45 f7             	lea    -0x9(%ebp),%eax
  8023ed:	89 44 24 04          	mov    %eax,0x4(%esp)
  8023f1:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
  8023f8:	e8 86 ef ff ff       	call   801383 <read>
	if (r < 0)
  8023fd:	85 c0                	test   %eax,%eax
  8023ff:	78 0f                	js     802410 <getchar+0x34>
		return r;
	if (r < 1)
  802401:	85 c0                	test   %eax,%eax
  802403:	7f 07                	jg     80240c <getchar+0x30>
  802405:	b8 f8 ff ff ff       	mov    $0xfffffff8,%eax
  80240a:	eb 04                	jmp    802410 <getchar+0x34>
		return -E_EOF;
	return c;
  80240c:	0f b6 45 f7          	movzbl -0x9(%ebp),%eax
}
  802410:	c9                   	leave  
  802411:	c3                   	ret    
	...

00802414 <_panic>:
 * It prints "panic: <message>", then causes a breakpoint exception,
 * which causes JOS to enter the JOS kernel monitor.
 */
void
_panic(const char *file, int line, const char *fmt,...)
{
  802414:	55                   	push   %ebp
  802415:	89 e5                	mov    %esp,%ebp
  802417:	53                   	push   %ebx
  802418:	83 ec 14             	sub    $0x14,%esp
 * Panic is called on unresolvable fatal errors.
 * It prints "panic: <message>", then causes a breakpoint exception,
 * which causes JOS to enter the JOS kernel monitor.
 */
void
_panic(const char *file, int line, const char *fmt,...)
  80241b:	8d 5d 14             	lea    0x14(%ebp),%ebx
	va_list ap;

	va_start(ap, fmt);

	// Print the panic message
	if (argv0)
  80241e:	a1 78 60 80 00       	mov    0x806078,%eax
  802423:	85 c0                	test   %eax,%eax
  802425:	74 10                	je     802437 <_panic+0x23>
		cprintf("%s: ", argv0);
  802427:	89 44 24 04          	mov    %eax,0x4(%esp)
  80242b:	c7 04 24 81 2c 80 00 	movl   $0x802c81,(%esp)
  802432:	e8 f6 dc ff ff       	call   80012d <cprintf>
	cprintf("user panic in %s at %s:%d: ", binaryname, file, line);
  802437:	8b 45 0c             	mov    0xc(%ebp),%eax
  80243a:	89 44 24 0c          	mov    %eax,0xc(%esp)
  80243e:	8b 45 08             	mov    0x8(%ebp),%eax
  802441:	89 44 24 08          	mov    %eax,0x8(%esp)
  802445:	a1 00 60 80 00       	mov    0x806000,%eax
  80244a:	89 44 24 04          	mov    %eax,0x4(%esp)
  80244e:	c7 04 24 86 2c 80 00 	movl   $0x802c86,(%esp)
  802455:	e8 d3 dc ff ff       	call   80012d <cprintf>
	vcprintf(fmt, ap);
  80245a:	89 5c 24 04          	mov    %ebx,0x4(%esp)
  80245e:	8b 45 10             	mov    0x10(%ebp),%eax
  802461:	89 04 24             	mov    %eax,(%esp)
  802464:	e8 63 dc ff ff       	call   8000cc <vcprintf>
	cprintf("\n");
  802469:	c7 04 24 6e 2c 80 00 	movl   $0x802c6e,(%esp)
  802470:	e8 b8 dc ff ff       	call   80012d <cprintf>

	// Cause a breakpoint exception
	while (1)
		asm volatile("int3");
  802475:	cc                   	int3   
  802476:	eb fd                	jmp    802475 <_panic+0x61>
	...

00802480 <ipc_send>:
//   Use sys_yield() to be CPU-friendly.
//   If 'pg' is null, pass sys_ipc_recv a value that it will understand
//   as meaning "no page".  (Zero is not the right value.)
void
ipc_send(envid_t to_env, uint32_t val, void *pg, int perm)
{
  802480:	55                   	push   %ebp
  802481:	89 e5                	mov    %esp,%ebp
  802483:	57                   	push   %edi
  802484:	56                   	push   %esi
  802485:	53                   	push   %ebx
  802486:	83 ec 2c             	sub    $0x2c,%esp
  802489:	8b 75 08             	mov    0x8(%ebp),%esi
  80248c:	8b 7d 0c             	mov    0xc(%ebp),%edi
  80248f:	8b 5d 10             	mov    0x10(%ebp),%ebx
  int r   = 0;
  while (1) {
    if ((r=sys_ipc_try_send(to_env, val, (pg==NULL?(void *)UTOP:pg), perm)) == -E_IPC_NOT_RECV)
  802492:	85 db                	test   %ebx,%ebx
  802494:	b8 00 00 c0 ee       	mov    $0xeec00000,%eax
  802499:	0f 45 c3             	cmovne %ebx,%eax
  80249c:	8b 55 14             	mov    0x14(%ebp),%edx
  80249f:	89 54 24 0c          	mov    %edx,0xc(%esp)
  8024a3:	89 44 24 08          	mov    %eax,0x8(%esp)
  8024a7:	89 7c 24 04          	mov    %edi,0x4(%esp)
  8024ab:	89 34 24             	mov    %esi,(%esp)
  8024ae:	e8 6d e8 ff ff       	call   800d20 <sys_ipc_try_send>
  8024b3:	83 f8 f9             	cmp    $0xfffffff9,%eax
  8024b6:	75 0a                	jne    8024c2 <ipc_send+0x42>
      sys_yield();
  8024b8:	e8 f8 ea ff ff       	call   800fb5 <sys_yield>
    else if (r < 0)
      panic("ipc_send to [%x] failed. Error: %x\n", to_env, r);
    else
      return;
  }
  8024bd:	8d 76 00             	lea    0x0(%esi),%esi
  8024c0:	eb d0                	jmp    802492 <ipc_send+0x12>
{
  int r   = 0;
  while (1) {
    if ((r=sys_ipc_try_send(to_env, val, (pg==NULL?(void *)UTOP:pg), perm)) == -E_IPC_NOT_RECV)
      sys_yield();
    else if (r < 0)
  8024c2:	85 c0                	test   %eax,%eax
  8024c4:	79 24                	jns    8024ea <ipc_send+0x6a>
      panic("ipc_send to [%x] failed. Error: %x\n", to_env, r);
  8024c6:	89 44 24 10          	mov    %eax,0x10(%esp)
  8024ca:	89 74 24 0c          	mov    %esi,0xc(%esp)
  8024ce:	c7 44 24 08 a4 2c 80 	movl   $0x802ca4,0x8(%esp)
  8024d5:	00 
  8024d6:	c7 44 24 04 36 00 00 	movl   $0x36,0x4(%esp)
  8024dd:	00 
  8024de:	c7 04 24 c8 2c 80 00 	movl   $0x802cc8,(%esp)
  8024e5:	e8 2a ff ff ff       	call   802414 <_panic>
    else
      return;
  }
}
  8024ea:	83 c4 2c             	add    $0x2c,%esp
  8024ed:	5b                   	pop    %ebx
  8024ee:	5e                   	pop    %esi
  8024ef:	5f                   	pop    %edi
  8024f0:	5d                   	pop    %ebp
  8024f1:	c3                   	ret    

008024f2 <ipc_recv>:
//   If 'pg' is null, pass sys_ipc_recv a value that it will understand
//   as meaning "no page".  (Zero is not the right value, since that's
//   a perfectly valid place to map a page.)
int32_t
ipc_recv(envid_t *from_env_store, void *pg, int *perm_store)
{
  8024f2:	55                   	push   %ebp
  8024f3:	89 e5                	mov    %esp,%ebp
  8024f5:	56                   	push   %esi
  8024f6:	53                   	push   %ebx
  8024f7:	83 ec 10             	sub    $0x10,%esp
  8024fa:	8b 5d 08             	mov    0x8(%ebp),%ebx
  8024fd:	8b 45 0c             	mov    0xc(%ebp),%eax
  802500:	8b 75 10             	mov    0x10(%ebp),%esi
  int r;
  if ((r=sys_ipc_recv((pg==NULL?(void *)UTOP:pg)))<0)
  802503:	85 c0                	test   %eax,%eax
  802505:	ba 00 00 c0 ee       	mov    $0xeec00000,%edx
  80250a:	0f 44 c2             	cmove  %edx,%eax
  80250d:	89 04 24             	mov    %eax,(%esp)
  802510:	e8 ae e7 ff ff       	call   800cc3 <sys_ipc_recv>
  802515:	85 c0                	test   %eax,%eax
  802517:	78 24                	js     80253d <ipc_recv+0x4b>
    return r;

  if (from_env_store)
  802519:	85 db                	test   %ebx,%ebx
  80251b:	74 0a                	je     802527 <ipc_recv+0x35>
    *from_env_store = env->env_ipc_from;
  80251d:	a1 74 60 80 00       	mov    0x806074,%eax
  802522:	8b 40 74             	mov    0x74(%eax),%eax
  802525:	89 03                	mov    %eax,(%ebx)

  if (perm_store)
  802527:	85 f6                	test   %esi,%esi
  802529:	74 0a                	je     802535 <ipc_recv+0x43>
    *perm_store     = env->env_ipc_perm;
  80252b:	a1 74 60 80 00       	mov    0x806074,%eax
  802530:	8b 40 78             	mov    0x78(%eax),%eax
  802533:	89 06                	mov    %eax,(%esi)

  return env->env_ipc_value;
  802535:	a1 74 60 80 00       	mov    0x806074,%eax
  80253a:	8b 40 70             	mov    0x70(%eax),%eax
}
  80253d:	83 c4 10             	add    $0x10,%esp
  802540:	5b                   	pop    %ebx
  802541:	5e                   	pop    %esi
  802542:	5d                   	pop    %ebp
  802543:	c3                   	ret    

00802544 <pageref>:
#include <inc/lib.h>

int
pageref(void *v)
{
  802544:	55                   	push   %ebp
  802545:	89 e5                	mov    %esp,%ebp
	pte_t pte;

	if (!(vpd[PDX(v)] & PTE_P))
  802547:	8b 45 08             	mov    0x8(%ebp),%eax
  80254a:	89 c2                	mov    %eax,%edx
  80254c:	c1 ea 16             	shr    $0x16,%edx
  80254f:	8b 14 95 00 d0 7b ef 	mov    -0x10843000(,%edx,4),%edx
  802556:	f6 c2 01             	test   $0x1,%dl
  802559:	74 26                	je     802581 <pageref+0x3d>
		return 0;
	pte = vpt[VPN(v)];
  80255b:	c1 e8 0c             	shr    $0xc,%eax
  80255e:	8b 04 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%eax
	if (!(pte & PTE_P))
  802565:	a8 01                	test   $0x1,%al
  802567:	74 18                	je     802581 <pageref+0x3d>
		return 0;
	return pages[PPN(pte)].pp_ref;
  802569:	c1 e8 0c             	shr    $0xc,%eax
  80256c:	8d 14 40             	lea    (%eax,%eax,2),%edx
  80256f:	c1 e2 02             	shl    $0x2,%edx
  802572:	b8 00 00 00 ef       	mov    $0xef000000,%eax
  802577:	0f b7 44 02 08       	movzwl 0x8(%edx,%eax,1),%eax
  80257c:	0f b7 c0             	movzwl %ax,%eax
  80257f:	eb 05                	jmp    802586 <pageref+0x42>
  802581:	b8 00 00 00 00       	mov    $0x0,%eax
}
  802586:	5d                   	pop    %ebp
  802587:	c3                   	ret    
	...

00802590 <__udivdi3>:
  802590:	55                   	push   %ebp
  802591:	89 e5                	mov    %esp,%ebp
  802593:	57                   	push   %edi
  802594:	56                   	push   %esi
  802595:	83 ec 10             	sub    $0x10,%esp
  802598:	8b 45 14             	mov    0x14(%ebp),%eax
  80259b:	8b 55 08             	mov    0x8(%ebp),%edx
  80259e:	8b 75 10             	mov    0x10(%ebp),%esi
  8025a1:	8b 7d 0c             	mov    0xc(%ebp),%edi
  8025a4:	85 c0                	test   %eax,%eax
  8025a6:	89 55 f0             	mov    %edx,-0x10(%ebp)
  8025a9:	75 35                	jne    8025e0 <__udivdi3+0x50>
  8025ab:	39 fe                	cmp    %edi,%esi
  8025ad:	77 61                	ja     802610 <__udivdi3+0x80>
  8025af:	85 f6                	test   %esi,%esi
  8025b1:	75 0b                	jne    8025be <__udivdi3+0x2e>
  8025b3:	b8 01 00 00 00       	mov    $0x1,%eax
  8025b8:	31 d2                	xor    %edx,%edx
  8025ba:	f7 f6                	div    %esi
  8025bc:	89 c6                	mov    %eax,%esi
  8025be:	8b 4d f0             	mov    -0x10(%ebp),%ecx
  8025c1:	31 d2                	xor    %edx,%edx
  8025c3:	89 f8                	mov    %edi,%eax
  8025c5:	f7 f6                	div    %esi
  8025c7:	89 c7                	mov    %eax,%edi
  8025c9:	89 c8                	mov    %ecx,%eax
  8025cb:	f7 f6                	div    %esi
  8025cd:	89 c1                	mov    %eax,%ecx
  8025cf:	89 fa                	mov    %edi,%edx
  8025d1:	89 c8                	mov    %ecx,%eax
  8025d3:	83 c4 10             	add    $0x10,%esp
  8025d6:	5e                   	pop    %esi
  8025d7:	5f                   	pop    %edi
  8025d8:	5d                   	pop    %ebp
  8025d9:	c3                   	ret    
  8025da:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
  8025e0:	39 f8                	cmp    %edi,%eax
  8025e2:	77 1c                	ja     802600 <__udivdi3+0x70>
  8025e4:	0f bd d0             	bsr    %eax,%edx
  8025e7:	83 f2 1f             	xor    $0x1f,%edx
  8025ea:	89 55 f4             	mov    %edx,-0xc(%ebp)
  8025ed:	75 39                	jne    802628 <__udivdi3+0x98>
  8025ef:	3b 75 f0             	cmp    -0x10(%ebp),%esi
  8025f2:	0f 86 a0 00 00 00    	jbe    802698 <__udivdi3+0x108>
  8025f8:	39 f8                	cmp    %edi,%eax
  8025fa:	0f 82 98 00 00 00    	jb     802698 <__udivdi3+0x108>
  802600:	31 ff                	xor    %edi,%edi
  802602:	31 c9                	xor    %ecx,%ecx
  802604:	89 c8                	mov    %ecx,%eax
  802606:	89 fa                	mov    %edi,%edx
  802608:	83 c4 10             	add    $0x10,%esp
  80260b:	5e                   	pop    %esi
  80260c:	5f                   	pop    %edi
  80260d:	5d                   	pop    %ebp
  80260e:	c3                   	ret    
  80260f:	90                   	nop
  802610:	89 d1                	mov    %edx,%ecx
  802612:	89 fa                	mov    %edi,%edx
  802614:	89 c8                	mov    %ecx,%eax
  802616:	31 ff                	xor    %edi,%edi
  802618:	f7 f6                	div    %esi
  80261a:	89 c1                	mov    %eax,%ecx
  80261c:	89 fa                	mov    %edi,%edx
  80261e:	89 c8                	mov    %ecx,%eax
  802620:	83 c4 10             	add    $0x10,%esp
  802623:	5e                   	pop    %esi
  802624:	5f                   	pop    %edi
  802625:	5d                   	pop    %ebp
  802626:	c3                   	ret    
  802627:	90                   	nop
  802628:	0f b6 4d f4          	movzbl -0xc(%ebp),%ecx
  80262c:	89 f2                	mov    %esi,%edx
  80262e:	d3 e0                	shl    %cl,%eax
  802630:	89 45 ec             	mov    %eax,-0x14(%ebp)
  802633:	b8 20 00 00 00       	mov    $0x20,%eax
  802638:	2b 45 f4             	sub    -0xc(%ebp),%eax
  80263b:	89 c1                	mov    %eax,%ecx
  80263d:	d3 ea                	shr    %cl,%edx
  80263f:	0f b6 4d f4          	movzbl -0xc(%ebp),%ecx
  802643:	0b 55 ec             	or     -0x14(%ebp),%edx
  802646:	d3 e6                	shl    %cl,%esi
  802648:	89 c1                	mov    %eax,%ecx
  80264a:	89 75 e8             	mov    %esi,-0x18(%ebp)
  80264d:	89 fe                	mov    %edi,%esi
  80264f:	d3 ee                	shr    %cl,%esi
  802651:	0f b6 4d f4          	movzbl -0xc(%ebp),%ecx
  802655:	89 55 ec             	mov    %edx,-0x14(%ebp)
  802658:	8b 55 f0             	mov    -0x10(%ebp),%edx
  80265b:	d3 e7                	shl    %cl,%edi
  80265d:	89 c1                	mov    %eax,%ecx
  80265f:	d3 ea                	shr    %cl,%edx
  802661:	09 d7                	or     %edx,%edi
  802663:	89 f2                	mov    %esi,%edx
  802665:	89 f8                	mov    %edi,%eax
  802667:	f7 75 ec             	divl   -0x14(%ebp)
  80266a:	89 d6                	mov    %edx,%esi
  80266c:	89 c7                	mov    %eax,%edi
  80266e:	f7 65 e8             	mull   -0x18(%ebp)
  802671:	39 d6                	cmp    %edx,%esi
  802673:	89 55 ec             	mov    %edx,-0x14(%ebp)
  802676:	72 30                	jb     8026a8 <__udivdi3+0x118>
  802678:	8b 55 f0             	mov    -0x10(%ebp),%edx
  80267b:	0f b6 4d f4          	movzbl -0xc(%ebp),%ecx
  80267f:	d3 e2                	shl    %cl,%edx
  802681:	39 c2                	cmp    %eax,%edx
  802683:	73 05                	jae    80268a <__udivdi3+0xfa>
  802685:	3b 75 ec             	cmp    -0x14(%ebp),%esi
  802688:	74 1e                	je     8026a8 <__udivdi3+0x118>
  80268a:	89 f9                	mov    %edi,%ecx
  80268c:	31 ff                	xor    %edi,%edi
  80268e:	e9 71 ff ff ff       	jmp    802604 <__udivdi3+0x74>
  802693:	90                   	nop
  802694:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi
  802698:	31 ff                	xor    %edi,%edi
  80269a:	b9 01 00 00 00       	mov    $0x1,%ecx
  80269f:	e9 60 ff ff ff       	jmp    802604 <__udivdi3+0x74>
  8026a4:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi
  8026a8:	8d 4f ff             	lea    -0x1(%edi),%ecx
  8026ab:	31 ff                	xor    %edi,%edi
  8026ad:	89 c8                	mov    %ecx,%eax
  8026af:	89 fa                	mov    %edi,%edx
  8026b1:	83 c4 10             	add    $0x10,%esp
  8026b4:	5e                   	pop    %esi
  8026b5:	5f                   	pop    %edi
  8026b6:	5d                   	pop    %ebp
  8026b7:	c3                   	ret    
	...

008026c0 <__umoddi3>:
  8026c0:	55                   	push   %ebp
  8026c1:	89 e5                	mov    %esp,%ebp
  8026c3:	57                   	push   %edi
  8026c4:	56                   	push   %esi
  8026c5:	83 ec 20             	sub    $0x20,%esp
  8026c8:	8b 55 14             	mov    0x14(%ebp),%edx
  8026cb:	8b 4d 08             	mov    0x8(%ebp),%ecx
  8026ce:	8b 7d 10             	mov    0x10(%ebp),%edi
  8026d1:	8b 75 0c             	mov    0xc(%ebp),%esi
  8026d4:	85 d2                	test   %edx,%edx
  8026d6:	89 c8                	mov    %ecx,%eax
  8026d8:	89 4d f4             	mov    %ecx,-0xc(%ebp)
  8026db:	75 13                	jne    8026f0 <__umoddi3+0x30>
  8026dd:	39 f7                	cmp    %esi,%edi
  8026df:	76 3f                	jbe    802720 <__umoddi3+0x60>
  8026e1:	89 f2                	mov    %esi,%edx
  8026e3:	f7 f7                	div    %edi
  8026e5:	89 d0                	mov    %edx,%eax
  8026e7:	31 d2                	xor    %edx,%edx
  8026e9:	83 c4 20             	add    $0x20,%esp
  8026ec:	5e                   	pop    %esi
  8026ed:	5f                   	pop    %edi
  8026ee:	5d                   	pop    %ebp
  8026ef:	c3                   	ret    
  8026f0:	39 f2                	cmp    %esi,%edx
  8026f2:	77 4c                	ja     802740 <__umoddi3+0x80>
  8026f4:	0f bd ca             	bsr    %edx,%ecx
  8026f7:	83 f1 1f             	xor    $0x1f,%ecx
  8026fa:	89 4d f0             	mov    %ecx,-0x10(%ebp)
  8026fd:	75 51                	jne    802750 <__umoddi3+0x90>
  8026ff:	3b 7d f4             	cmp    -0xc(%ebp),%edi
  802702:	0f 87 e0 00 00 00    	ja     8027e8 <__umoddi3+0x128>
  802708:	8b 45 f4             	mov    -0xc(%ebp),%eax
  80270b:	29 f8                	sub    %edi,%eax
  80270d:	19 d6                	sbb    %edx,%esi
  80270f:	89 45 f4             	mov    %eax,-0xc(%ebp)
  802712:	8b 45 f4             	mov    -0xc(%ebp),%eax
  802715:	89 f2                	mov    %esi,%edx
  802717:	83 c4 20             	add    $0x20,%esp
  80271a:	5e                   	pop    %esi
  80271b:	5f                   	pop    %edi
  80271c:	5d                   	pop    %ebp
  80271d:	c3                   	ret    
  80271e:	66 90                	xchg   %ax,%ax
  802720:	85 ff                	test   %edi,%edi
  802722:	75 0b                	jne    80272f <__umoddi3+0x6f>
  802724:	b8 01 00 00 00       	mov    $0x1,%eax
  802729:	31 d2                	xor    %edx,%edx
  80272b:	f7 f7                	div    %edi
  80272d:	89 c7                	mov    %eax,%edi
  80272f:	89 f0                	mov    %esi,%eax
  802731:	31 d2                	xor    %edx,%edx
  802733:	f7 f7                	div    %edi
  802735:	8b 45 f4             	mov    -0xc(%ebp),%eax
  802738:	f7 f7                	div    %edi
  80273a:	eb a9                	jmp    8026e5 <__umoddi3+0x25>
  80273c:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi
  802740:	89 c8                	mov    %ecx,%eax
  802742:	89 f2                	mov    %esi,%edx
  802744:	83 c4 20             	add    $0x20,%esp
  802747:	5e                   	pop    %esi
  802748:	5f                   	pop    %edi
  802749:	5d                   	pop    %ebp
  80274a:	c3                   	ret    
  80274b:	90                   	nop
  80274c:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi
  802750:	0f b6 4d f0          	movzbl -0x10(%ebp),%ecx
  802754:	d3 e2                	shl    %cl,%edx
  802756:	89 55 f4             	mov    %edx,-0xc(%ebp)
  802759:	ba 20 00 00 00       	mov    $0x20,%edx
  80275e:	2b 55 f0             	sub    -0x10(%ebp),%edx
  802761:	89 55 ec             	mov    %edx,-0x14(%ebp)
  802764:	0f b6 4d ec          	movzbl -0x14(%ebp),%ecx
  802768:	89 fa                	mov    %edi,%edx
  80276a:	d3 ea                	shr    %cl,%edx
  80276c:	0f b6 4d f0          	movzbl -0x10(%ebp),%ecx
  802770:	0b 55 f4             	or     -0xc(%ebp),%edx
  802773:	d3 e7                	shl    %cl,%edi
  802775:	0f b6 4d ec          	movzbl -0x14(%ebp),%ecx
  802779:	89 55 f4             	mov    %edx,-0xc(%ebp)
  80277c:	89 f2                	mov    %esi,%edx
  80277e:	89 7d e8             	mov    %edi,-0x18(%ebp)
  802781:	89 c7                	mov    %eax,%edi
  802783:	d3 ea                	shr    %cl,%edx
  802785:	0f b6 4d f0          	movzbl -0x10(%ebp),%ecx
  802789:	89 55 e4             	mov    %edx,-0x1c(%ebp)
  80278c:	89 c2                	mov    %eax,%edx
  80278e:	d3 e6                	shl    %cl,%esi
  802790:	0f b6 4d ec          	movzbl -0x14(%ebp),%ecx
  802794:	d3 ea                	shr    %cl,%edx
  802796:	0f b6 4d f0          	movzbl -0x10(%ebp),%ecx
  80279a:	09 d6                	or     %edx,%esi
  80279c:	89 f0                	mov    %esi,%eax
  80279e:	8b 75 e4             	mov    -0x1c(%ebp),%esi
  8027a1:	d3 e7                	shl    %cl,%edi
  8027a3:	89 f2                	mov    %esi,%edx
  8027a5:	f7 75 f4             	divl   -0xc(%ebp)
  8027a8:	89 d6                	mov    %edx,%esi
  8027aa:	f7 65 e8             	mull   -0x18(%ebp)
  8027ad:	39 d6                	cmp    %edx,%esi
  8027af:	72 2b                	jb     8027dc <__umoddi3+0x11c>
  8027b1:	39 c7                	cmp    %eax,%edi
  8027b3:	72 23                	jb     8027d8 <__umoddi3+0x118>
  8027b5:	0f b6 4d f0          	movzbl -0x10(%ebp),%ecx
  8027b9:	29 c7                	sub    %eax,%edi
  8027bb:	19 d6                	sbb    %edx,%esi
  8027bd:	89 f0                	mov    %esi,%eax
  8027bf:	89 f2                	mov    %esi,%edx
  8027c1:	d3 ef                	shr    %cl,%edi
  8027c3:	0f b6 4d ec          	movzbl -0x14(%ebp),%ecx
  8027c7:	d3 e0                	shl    %cl,%eax
  8027c9:	0f b6 4d f0          	movzbl -0x10(%ebp),%ecx
  8027cd:	09 f8                	or     %edi,%eax
  8027cf:	d3 ea                	shr    %cl,%edx
  8027d1:	83 c4 20             	add    $0x20,%esp
  8027d4:	5e                   	pop    %esi
  8027d5:	5f                   	pop    %edi
  8027d6:	5d                   	pop    %ebp
  8027d7:	c3                   	ret    
  8027d8:	39 d6                	cmp    %edx,%esi
  8027da:	75 d9                	jne    8027b5 <__umoddi3+0xf5>
  8027dc:	2b 45 e8             	sub    -0x18(%ebp),%eax
  8027df:	1b 55 f4             	sbb    -0xc(%ebp),%edx
  8027e2:	eb d1                	jmp    8027b5 <__umoddi3+0xf5>
  8027e4:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi
  8027e8:	39 f2                	cmp    %esi,%edx
  8027ea:	0f 82 18 ff ff ff    	jb     802708 <__umoddi3+0x48>
  8027f0:	e9 1d ff ff ff       	jmp    802712 <__umoddi3+0x52>
